Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to resolve msp430 problem? #2280

Open
iamxg opened this issue Aug 4, 2017 · 66 comments
Open

How to resolve msp430 problem? #2280

iamxg opened this issue Aug 4, 2017 · 66 comments

Comments

@iamxg
Copy link

iamxg commented Aug 4, 2017

screenshot from 2017-08-03 23-08-20

@iamxg
Copy link
Author

iamxg commented Aug 4, 2017

msp430-gcc 4.6 upgrade to 4.7, but this issue still occur.

@fabricio-godoi
Copy link

@iamxg if you check carefully the line highlight the error mention that the code you trying to compile it's too big for the Sky mote (overflowed by 26KB of ROM).
I've seen a lot of people with this same issue. I recommend you to start with the Wismote, which has a lot more memory to run codes.

If you strictly need the Sky mote, I sugest you take a moment and reanalyze all specification needed in your project.

By the way, this is the motes memory:
Sky 48 KB ROM
Z1 up to 96 KB ROM
Wismote up to 256 KB ROM

Note: check if the makefile is configured correctly to use the memory needed.

Best regards!

@iamxg
Copy link
Author

iamxg commented Aug 4, 2017 via email

@lamnd09
Copy link

lamnd09 commented Aug 5, 2017

4.7.2 version works well, you can refer to past thread about this issue.

@iamxg
Copy link
Author

iamxg commented Aug 6, 2017

Ok, Thank you very much! I will try it.

@iamxg
Copy link
Author

iamxg commented Aug 6, 2017

screenshot from 2017-08-05 19-56-09

@iamxg
Copy link
Author

iamxg commented Aug 6, 2017

It can't work.

@lamnd09
Copy link

lamnd09 commented Aug 6, 2017

it's much better if you use Z1 instead of Sky.

@pcumino
Copy link

pcumino commented Aug 9, 2017

I'm having a similar issue. In my case I can compile a skymote as a border router using the file contiki/examples/ipv6/rpl-border-router/border-router.c (just as shown in here ).
But when I try to use a wismote instead, the error comes up. It says that there is no ROM available.
I've already tried:
To use the msp430-gcc v4.7.0 (in this case cooja didn't open);
To use two different versions installed msp430-gcc (4.6.3 and 4.7.0), but the error still occur.

Is this a compiling issue?
Any hint appreciated!

@iamxg
Copy link
Author

iamxg commented Aug 9, 2017

Hi everyone, Thanks a lot. I will try these methods.

@fabricio-godoi
Copy link

fabricio-godoi commented Aug 10, 2017

One last hint I can give you guys is to check if the Makefiles are correct.
Each platform has it's own makefile, like Makefile.wismote or Makefile.z1, look in it and check if it's enabled the CPU_HAS_MSP430X=1. This will enable in Makefile.msp430 to configure the ROM size of the MCU.
Note that Sky mote does not have this feature!

Also, check the "application".map file, there will be some section like this below, so check the actual length of the ROM to see how much is needed to run the code. Note that it's value is absolutely after compiling the code:

Memory-Configuration

Name-------------Origin-------------Length-------------Attributes
sfr----------------0x00000000---------0x00000010
peripheral_8bit--0x00000010---------0x000000f0
peripheral_16bit-0x00000100---------0x00000100
bsl---------------0x00001000---------0x00000800
infomem--------0x00001800---------0x00000200
infod------------0x00001800---------0x00000080
infoc------------0x00001880---------0x00000080
infob------------0x00001900---------0x00000080
infoa------------0x00001980---------0x00000080
ram--------------0x00001c00---------0x00004000---------xw
rom--------------0x00005c00---------0x0000a380---------xr <<<<<< HERE the ROM size
vectors----------0x0000ff80---------0x00000080
far_rom----------0x00010000---------0x00035c00
ram2-------------0x00000000---------0x00000000---------xw
ram_mirror-------0x00000000---------0x00000000---------xw
usbram-----------0x00000000---------0x00000000---------xw
default--------0x00000000---------0xffffffff

(I replaced the space with '-' to make easier to read here)

For more information see the options of the msp430-gcc:
https://gcc.gnu.org/onlinedocs/gcc/MSP430-Options.html

/platform/Wismote/Makefile.wismote
/cpu/msp430/Makefile.msp430

By the way, I'm using msp430-gcc 4.7.0.

Good luck!
Best regards!

@atiselsts
Copy link
Contributor

@fabricio-godoi program code is also stored in far_rom section - that's the one sky is missing and msp430-gcc-4.6 does not support.
If CPU_HAS_MSP430X=1 is defined and the toolchain is recent enough, it will put some parts of code in addresses >= 0x00010000, i.e. the extended memory.

Rumor has it that 4.7.2 and 4.7.3 has fixed some bugs related to the extended memory support.
Get the binaries here: https://github.com/pksec/msp430-gcc-4.7.3

@pcumino
Copy link

pcumino commented Aug 15, 2017

I solved the problem by updating the compiler following the instructions in here.
The main steps I followed:

  1. Installing msp430-gcc version 4.7.3 and restarted the VM. So both versions are installed. The shortcut for the new version is msp430-gcc-4.7.3
  2. Changing the file contiki/cpu/msp430/Makefile.msp430 . Updating the compiler used in CC (apparently for the ROM) and LD (apparently for the RAM) lines to the new one.
#CC    = msp430-gcc
CC     = msp430-gcc-4.7.3
#LD    = msp430-gcc
LD     = msp430-gcc-4.7.3

Now it is possible to compile the rpl-border-router.c using the wismote platform with 20-bit support.

Thanks, everyone.

@vishal623
Copy link

Hello,

I followed the same steps as per mentioned here but when I compiled with any mote like sky, z1 or wisemote it gives me the following error.

make: msp430-gcc-4.7.3: Command not found
fatal: Not a valid object name HEAD

Please help me.

1 similar comment
@vishal623
Copy link

Hello,

I followed the same steps as per mentioned here but when I compiled with any mote like sky, z1 or wisemote it gives me the following error.

make: msp430-gcc-4.7.3: Command not found
fatal: Not a valid object name HEAD

Please help me.

@iamxg
Copy link
Author

iamxg commented Nov 8, 2017 via email

@fabricio-godoi
Copy link

Hello everyone,

I reach a similar problem today, even with the CPU_HAS_MSP430X=1,
aparrently there some bug with this directive, not sure though.

I had to change the mcode-region flag from 'any' to 'far' at Makefile.msp430 line 156,
and then the code was able to be compiled.

Before:
CFLAGS += -ffunction-sections -fdata-sections -mcode-region=any
After:
CFLAGS += -ffunction-sections -fdata-sections -mcode-region=far

@atiselsts
I didn't know about the GCC versions problems, I just assumed that was
some kind of flag configuration problem, thanks you about it.
The sky mote does not have this feature because it has only 48K of ROM,
so I recommended switch it to the Wismote.

Regards

@greg-king5
Copy link

greg-king5 commented Nov 21, 2017

@vishal623, you must point your PATH environment variable to the 4.7.3 version's "bin" directory (step #2). But, don't do it in "~/.bashrc"! Do it in "~/.profile" (or "~/.bash_profile").

@vishal623
Copy link

vishal623 commented Nov 23, 2017 via email

@Siddarth1511
Copy link

was this problem solved ??

And by the way @vishal623 I had the same problem,
am still having troubles in upgrading my msp gcc compilers did you solve it?

@vishal623
Copy link

vishal623 commented Apr 10, 2018 via email

@Siddarth1511
Copy link

what did you do to solve it @vishal623 ?
I changed path in .profile it shows me this
screenshot from 2018-04-10 15 00 18

@vishal623
Copy link

vishal623 commented Apr 10, 2018 via email

@Siddarth1511
Copy link

oh alright
i will try doing that
did you follow the 2 steps given in the readme file
and also did you change CC = msp430-gcc line in makefile

@vishal623

@vishal623
Copy link

vishal623 commented Apr 10, 2018 via email

@greg-king5
Copy link

Try changing the PATH line to:

PATH=/opt/compilers/mspgcc-4.7.3/bin:$PATH

@Siddarth1511
Copy link

In which file .bashrc or .profile?? @greg-king5
Thanks for helping me out

@greg-king5
Copy link

~/.bashrc is for things that aren't inherited by shells -- such as aliases, environment variables that aren't exported, and functions. ~/.profile (or ~/.bash_profile) is for system settings and exported variables (such as PATH).

@Siddarth1511
Copy link

It worked!!!
Thank you so much @greg-king5 @vishal623
It didn't work when i tried what you said in Instant contiki (VMware player)
But worked when i tried in dual boot ubuntu 14.04
Thanks again!

@vishal623
Copy link

Hello @Siddarth1511

I have followed the steps that were given by https://github.com/pksec/msp430-gcc-4.7.3.

  1. I didn't remove the olde version of msp430.
  2. I have extracted the msp430-gcc-4.7.3 to /opt/compilers/. Inside that there will be one more zip file so I also extracted it and mv outside of that directory and gave the name of msp430-gcc-4.7.3.
  3. I have added the path in /etc/environment. which is msp430-gcc-4.7.3/msp430/bin
  4. I have added the path in ~/.profile. which is msp430-gcc-4.7.3/bin
  5. I have also updated the CC and LD variables in Makefile.msp430

When I checked the version of msp430 it shows me 4.7.3 but when I run the border router on sky mote it shows ms msp430-gcc-4.7.3 command not found.
Even when I run the er-rest-client on z1 it shows me the same error.

@M-90
Copy link

M-90 commented Oct 30, 2018

hi , how i can install a contiki on ubuntu please ??

@Sara-94
Copy link

Sara-94 commented Mar 20, 2019

Hello @vishal623
I also follow the same steps and i have the same problem, the version shows me 4.7.3 but Cooja shows me msp430-gcc-4.7.3 command not found.
please did you solve the problem?

@Siddarth1511
Copy link

@vishal623
@Sara-94
Sorry for the delayed reply. I followed the exact same steps and restarted ubuntu once more
And it worked for me.
Did you echo your path and see if it points to 4.7.3 version
?

@Sara-94
Copy link

Sara-94 commented Mar 20, 2019

Thank you so much for replay @Siddarth1511
This is the echo of the PATH
echo
it point to 4.7.3 version

@vishal623
Copy link

vishal623 commented Mar 21, 2019 via email

@Sara-94
Copy link

Sara-94 commented Mar 21, 2019

Thanks for your replay @vishal623
I tried from 3 weeks and try the steps for Contiki 3.0 and Contiki 2.7, also i try it in other computer and its still not work
Is there any other ways to increase the memory of z1 mote?
Note: i know that the wismote have more memory than z1 but when i try the code on z1 it overflow by 2300 bytes (for coap server and border router run without problem) and when try wismote it overflow by 7476 bytes (for border router) and 12982 (for coap server), why the wismote seems to have less memory than z1 mote??

@Sara-94
Copy link

Sara-94 commented Mar 25, 2019

Hello @vishal623
I can force Cooja to use msp430-gcc-4.7.3 by using "sudo update-alternatives --install /usr/bin/msp430-gcc gcc /opt/compiler/mspgcc-4.7.3/bin/msp430-gcc-4.7.3 50"
also use "sudo update-alternatives --install /usr/bin/msp430-gcc gcc /usr/bin/msp430-gcc-4.6.3 40" so you can choose any version you want by using "sudo update-alternatives --config gcc"
but another error appear as this picture, I dont know how to fix it
errors

@vishal623
Copy link

vishal623 commented Mar 25, 2019 via email

@tejaeluri
Copy link

This is what i did (it works for me):
1- install ubuntu 14-04 (32bit)
2- download latest contiki 3.0 from sourceforge.net
2.1- extract contiki 3.0 files in "/home/"
3- Download the msp430-47 binary files from sourceforge.net
(*msp430-47 is an experimental tool chain which gives extra 20bit memory for motes)
3.1- Extract the files in "/home/msp430-47"
3.2- In Home directory click (Ctrl+H) to open hidden files and find ".bashrc" and ".profile" files
3.3 open those files and add “export PATH=/home/user/msp430-47/bin:$PATH” in end of the codes.
(*this Path will helps the Contiki to use the tool chain)
4- To increase Z1 motes memory
4.1 go to path "Home/contiki/platform/z1"
4.2 open file "contiki-conf.h"
4.3 increase buffer size to 240
" #define UIP_CONF_BUFFER_SIZE 240" and save it
4.4 restart pc
4.5 its done

@vishal623
Copy link

vishal623 commented Mar 26, 2019 via email

@greg-king5
Copy link

greg-king5 commented Mar 27, 2019

3.2- In Home directory, click (Ctrl+H) to open hidden files, and find ".bashrc" and ".profile" files.
3.3 Open those files, and add “export PATH=/home/user/msp430-47/bin:$PATH” in end of the codes.
(*that Path will help the Contiki to use the tool chain.)

Don't put that "export PATH ..." line in "~/.bashrc". (Put it in only "~/.profile".)

@vishal623
Copy link

vishal623 commented Mar 27, 2019 via email

@greg-king5
Copy link

greg-king5 commented Mar 27, 2019

vishal@vishal-OptiPlex-9020:~$ gcc --version
gcc (GCC) 4.7.3 20130411 (mspgcc dev 20120911)
Copyright (C) 2012 Free Software Foundation, Inc.

vishal@vishal-OptiPlex-9020:~$ msp430-gcc --version
msp430-gcc (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
Copyright (C) 2015 Free Software Foundation, Inc.

That happened after executing the "sudo update-alternatives --install /usr/bin/msp430-gcc gcc /opt/compiler/mspgcc-4.7.3/bin/msp430-gcc-4.7.3 50" command. Why?

The gcc behavior looks as though you already have a "gcc" group in your alternatives. That update-alternatives command added another alternative link that has a higher priority than the one that gcc should use. You must remove the new link:

sudo update-alternatives --remove gcc /opt/compiler/mspgcc-4.7.3/bin/msp430-gcc-4.7.3

The msp430-gcc behavior looks as though your PATH points to the old compiler's "bin/" before it points to "/usr/bin/". The "alternatives" method cannot work for you.

Is there a line in your "~/.profile" that points to the old compiler's "bin/"? If so, then comment it.

@vishal623
Copy link

vishal623 commented Mar 28, 2019 via email

@greg-king5
Copy link

Now, I am able to get the 4.7.3 for both.

vishal@vishal-OptiPlex-9020:~$ gcc --version
gcc (GCC) 4.7.3 20130411 (mspgcc dev 20120911)
Copyright (C) 2012 Free Software Foundation, Inc.

vishal@vishal-OptiPlex-9020:~$ msp430-gcc --version
msp430-gcc (GCC) 4.7.3 20130411 (mspgcc dev 20120911)
Copyright (C) 2012 Free Software Foundation, Inc.

The gcc command must not run the same program that msp430-gcc runs! gcc must run the Ubuntu system compilers. Did you do the following advice?

The update-alternatives command added another alternative link that has a higher priority than the one that gcc should use. You must remove the new link:

sudo update-alternatives --remove gcc /opt/compiler/mspgcc-4.7.3/bin/msp430-gcc-4.7.3

@vishal623
Copy link

vishal623 commented Mar 29, 2019 via email

@greg-king5
Copy link

I have removed the link. Now the output is different.

vishal@vishal-OptiPlex-9020:~$ gcc --version
gcc (GCC) 4.7.3 20130411 (mspgcc dev 20120911)
Copyright (C) 2012 Free Software Foundation, Inc.

vishal@vishal-OptiPlex-9020:~$ msp430-gcc --version
msp430-gcc (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
Copyright (C) 2015 Free Software Foundation, Inc.

In my "~/.profile", only one path is there. Below is the line in my profile:

export PATH=$PATH:/opt/compilers/mspgcc-4.7.3/bin

OK, those arguments are backwards. Swap them:

export PATH=/opt/compilers/mspgcc-4.7.3/bin:$PATH

By the way, have you tried using that "5.5.0" version of the msp430 compiler to build your mote programs?

My "/etc/environment" file:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/compilers/mspgcc-4.7.3/msp430/bin"

Apparently, that gcc command comes from the last path in that "PATH=" line. That "bin/" directory is for old, old scripts that don't know about the "msp430-" prefix. But, Contiki does know; it does use the prefix. Therefore, that path shouldn't be in "/etc/environment".

@vishal623
Copy link

vishal623 commented Mar 30, 2019 via email

@vishal623
Copy link

vishal623 commented Apr 15, 2019 via email

@greg-king5
Copy link

export PATH=$PATH:/opt/compilers/mspgcc-4.7.3/bin

That should be

export PATH=/opt/compilers/mspgcc-4.7.3/bin:$PATH

@ali680
Copy link

ali680 commented Feb 2, 2020

how can change RPL in multi path in contiki os

@munaalakhras
Copy link

This is what i did (it works for me):
1- install ubuntu 14-04 (32bit)
2- download latest contiki 3.0 from sourceforge.net
2.1- extract contiki 3.0 files in "/home/"
3- Download the msp430-47 binary files from sourceforge.net
(*msp430-47 is an experimental tool chain which gives extra 20bit memory for motes)
3.1- Extract the files in "/home/msp430-47"
3.2- In Home directory click (Ctrl+H) to open hidden files and find ".bashrc" and ".profile" files
3.3 open those files and add “export PATH=/home/user/msp430-47/bin:$PATH” in end of the codes.
(*this Path will helps the Contiki to use the tool chain)
4- To increase Z1 motes memory
4.1 go to path "Home/contiki/platform/z1"
4.2 open file "contiki-conf.h"
4.3 increase buffer size to 240
" #define UIP_CONF_BUFFER_SIZE 240" and save it
4.4 restart pc
4.5 its done

Thanks for this solution............since my ubuntu is 32 bit, and I attempted to install MSP430-gcc-4.7.3 but doesn't work because it only works for a 64-bit environment.
At the last minute, I catch up with your comment before I decided to upgrade my ubuntu to 64 bit and I was about to lose all of my works in Contiki 2.7.
Again, Thanks for saving my time. 💯

I recommend every one who has 32-bit ubuntu to use these steps literally

@mehdizirak
Copy link

mehdizirak commented May 18, 2022

hello everyone
I am working on RPL Routing protocol on contiki os. when i want to run rpl-tsch example i get an error that told me there is not enough space on ROM. by reading #2280 understand that must upgrade mspsim from 4.6 to 4.7.3. I am using ubuntu 16.04 64-bit with gcc on Vmware. these are the steps that i do:

  1. download msp4.7.3 binary from here: https://github.com/pksec/msp430-gcc-4.7.3

  2. extract it on /opt/compilers so the content of /opt/compilers is:
    https://i.stack.imgur.com/TePKn.png

  3. add /opt/compilers/mspgcc-4.7.3/MSP430/bin/ to /etc/enviroment so the content of this file is:
    PATH="/opt/compilers/mspgcc-4.7.3/msp430/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"

4.add export PATH=$PATH:/opt/compilers/mspgcc-4.7.3/bin to /home/.profile

5.remove msp430 4.6 using this command: sudo apt-get remove gcc-msp430

6.restart virtual machine

7.now the $PATH is:
/opt/compilers/mspgcc-4.7.3/msp430/bin:/home/ubuntu/bin:/home/ubuntu/.local/bin:/opt/compilers/mspgcc-4.7.3/msp430/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

but when type msp430-gcc --version I get this error:

The program 'msp430-gcc' is currently not installed. You can install it by typing:
sudo apt install gcc-msp430

@poornimagowda
Copy link

when i try to compile it will show the following error what to do?

make hello-world.sky TARGET=sky
make: msp430-gcc: Command not found
make: msp430-gcc: Command not found
fatal: Not a git repository: '../../.git'
mkdir obj_sky
CC ../../platform/sky/./contiki-sky-platform.c
make: msp430-gcc: Command not found
make: *** [obj_sky/contiki-sky-platform.o] Error 127
Process returned error code 2

@poornimagowda
Copy link

I am a beginner to cooja I have installed Contiki 3.0 and tried to run examples hello-world. c...but it is showing a compilation error...please help me

make hello-world.sky TARGET=sky
make: msp430-gcc: Command not found
make: msp430-gcc: Command not found
fatal: Not a git repository: '../../.git'
CC ../../platform/sky/./contiki-sky-platform.c
make: msp430-gcc: Command not found
make: *** [obj_sky/contiki-sky-platform.o] Error 127
Process returned error code 2

@hknaydin
Copy link

You have to install gcc-msp430 with the following command:

sudo apt-get install gcc-msp430

@poornimagowda
Copy link

@hknaydin..... Thank you

alexrayne pushed a commit to alexrayne/contiki that referenced this issue Jan 28, 2023
The build system was changed, so pick some other
embedded target that is not Cooja.

Fixes contiki-os#2280.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests