meghs94 / tinyos-main

Automatically exported from code.google.com/p/tinyos-main
1 stars 0 forks source link

Global constants removed in tosboot (mspgcc 4.6.3) #157

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
4.6.3 places global constants in the .rodata section. This section gets 
discarded in the last build step, i.e. while removing the interrupt vector 
table from tosboot. The command below only preserves .text and .data sections.

msp430-objcopy -j .text -j .data -O ihex build/platform/main.exe 
build/platform/main.ihex

The command in strip_iv rule in tosboot Makefile should be changed to something 
like

msp430-objcopy -j .text -j .data -j .rodata -O ihex $(BUILDDIR)/main.exe 
$(BUILDDIR)/main.ihex

or maybe even better to

msp430-objcopy -R .vectors -O ihex $(BUILDDIR)/main.exe $(BUILDDIR)/main.ihex

in order to preserve the .rodata section.

---Background---
This problem does not occur on every platform. Telosb for example works fine 
since no data is placed in the .rodata section. I noticed this issue while 
compiling tosboot/Deluge for a 2618 based platform. Everything except 
reprogramming from external flash works. After a reboot tosboot initializes all 
USCI registers to 0xFF since the correct values from 'const 
msp430_spi_union_config_t msp430_spi_default_config' (msp430usci.h) were 
stripped off the binary. Therefor communication with the external flash fails. 
However, writing an image to external flash works because this is done in the 
application. USCI registers get initialized with correct values in the 
application since nothing is stripped off that code.

Original issue reported on code.google.com by jns.neba...@gmail.com on 6 Dec 2012 at 9:19

GoogleCodeExporter commented 8 years ago

Original comment by vlado.handziski on 6 Dec 2012 at 10:52