http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59558
Bug ID: 59558 Summary: [MSP430-gcc] CPU setup, pre start program Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jkroby at p3r dot info Gcc: msp430-gcc (GNU GCC patched mspgcc-20110716) 4.5.3 Run on msp430G2553 Library used: Energia 0101E0009 compiled on host: Linux version 3.2.0-56-generic (buildd@roseapple) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #86-Ubuntu SMP Wed Oct 23 09:20:45 UTC 2013 I have wrote a big program with many library and i test it from some month, all OK but, when i add new code i found a strange think, the CPU do nothink so i use debugger and i find the problem: using msp430g2553 with 510 bytes of ram memory used (512 max), (calculation way: i enlarge the variable and i use the linker error to calculate the size, i reduce the size for stay in the limit) With debugger i discover: the first instruction CPU load from 0x0120 WDTCTL in 0x03fc address ram and make an or so the location becam 0x5408, it use this value for reset wdt, i think before energia initialize it, SP is initialized to 0x0400 when the code use CALL and RET (for init) overwrite that value at 0x03fc so when it use the value for clear Watchdog happen a PUC because the write pin(password) is not correct (WDTPW that has to be 5A high byte is 0xda, call return address of the stack). i reduce the code of 4 bytes for be sure and it works. All is ok only the space conflict with stack and temporary variable is a problem. I hope to be clear, i'm ready to give more detail. I think is a problem of the library for initialization but i don't know which component is. Roberto Pomo <jkr...@p3r.info>