I'm using an MSP430FR5949 microcontroller. After installing release 4.0.1.0 of the gcc tool chain (from here), assembly of a custom crt0.S through gcc results in numerous errors, all involving the new macros:
/opt/ti/gcc-4.0.1.0/include/msp430fr5949.h:155: Error: unknown opcode `sfr_w(adc12ctl0)'
/opt/ti/gcc-4.0.1.0/include/msp430fr5949.h:156: Error: unknown opcode `sfr_b(adc12ctl0_l)'
The source file, crt0.S, includes msp430.h, which includes msp430fr5949.h, which includes iomacros.h. In iomacros.h, new macros have been defined that were mentioned in the release notes:
- Key Changes to Header & Support Files
- .persistent section added to linker script
- New file for symbol definitions is added for every device
- new macros added to iomacro.h
#define sfr_b(x) extern volatile unsigned char x
#define sfr_w(x) extern volatile unsigned int x
#define sfr_a(x) extern volatile unsigned long int x
#define sfr_l(x) extern volatile unsigned long int x
- heap memory support added to linker scripts
These new macros are referenced hundred of times in msp430fr5949.h, 797 times to be precise. The only problem is that when __ASSEMBLER__ is defined, these new macros are not defined. Instead, the older sfrb, sfrw, sfra, and sfrl are defined.
iomacros.h needs to be updated to include definitions of the new macros when __ASSEMBLER__ is defined.
It appears that when compiling, these macros are designed to declare an external variable, which means that such variables must be defined elsewhere.
Thus, they should be declared as external when assembling. The GNU assembler, as, documentation states:
.extern
.extern
is accepted in the source program--for compatibility with other assemblers--but it is ignored. as
treats all undefined symbols as external.
Until a permanent fix for this can be published, would a good interim workaround be to modify the iomacros.h file such that the macros mentioned above expand to nothing when assembling?
#define sfr_b(x)
#define sfr_w(x)#define sfr_a(x)
#define sfr_l(x)
Suggestions would be appreciated.
Thanks,
- Chuck