Part Number: MSP430F5510
Tool/software: TI C/C++ Compiler
For some reason, all of a sudden, the linker has decided to relocate constants into a black hole.
Here's the layout in the linker cmd file in my project:
MEMORY
{
SFR : origin = 0x0000, length = 0x0010
PERIPHERALS_8BIT : origin = 0x0010, length = 0x00F0
PERIPHERALS_16BIT : origin = 0x0100, length = 0x0100
RAM : origin = 0x2400, length = 0x1000
USBRAM : origin = 0x1C00, length = 0x0800
INFOA : origin = 0x1980, length = 0x0080
INFOB : origin = 0x1900, length = 0x0080
INFOC : origin = 0x1880, length = 0x0080
INFOD : origin = 0x1800, length = 0x0080
FLASH : origin = 0x8000, length = 0x7F80
INT00 : origin = 0xFF80, length = 0x0002
INT01 : origin = 0xFF82, length = 0x0002
INT02 : origin = 0xFF84, length = 0x0002
INT03 : origin = 0xFF86, length = 0x0002
INT04 : origin = 0xFF88, length = 0x0002
Here's the trivial definition in main.cxx:
const char banner[] = "Test board Rev 2";
Here's what the memory browser shows:
banner FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF USBTMC<USBTMC_AppDelegate>::bulk_dev_req()::string FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF USBTMC<USBTMC_AppDelegate>::service()::string (instance 6) FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF evmap
With "banner" relocated to 00A2A2.
This is a hole!
Many if not ALL other constants seem to have ended up there as well.
This just suddenly started today and I have no idea why it does this. It says nothing when building
It doesn't get far; just prints garbage and get stuck at 3fff (since vtables end up there as well).
Also tried adding __attributes__((section (".const:))) to it definition, but this makes no difference.
Checking with nm on OS X (recompiled, so things moved a bit):
$ nm protoboard5510.out | fgrep banner
0000a09c b banner
$
Linker map:
******************************************************************************
MSP430 Linker Unix v16.9.4
******************************************************************************
>> Linked Fri Jan 26 02:18:32 2018
OUTPUT FILE NAME: <protoboard5510.out>
ENTRY POINT SYMBOL: "_c_int00_noargs" address: 00009f2c
MEMORY CONFIGURATION
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
SFR 00000000 00000010 00000000 00000010 RWIX
PERIPHERALS_8BIT 00000010 000000f0 00000000 000000f0 RWIX
PERIPHERALS_16BIT 00000100 00000100 00000000 00000100 RWIX
INFOD 00001800 00000080 00000000 00000080 RWIX
INFOC 00001880 00000080 00000000 00000080 RWIX
INFOB 00001900 00000080 00000000 00000080 RWIX
INFOA 00001980 00000080 00000000 00000080 RWIX
USBRAM 00001c00 00000800 00000000 00000800 RWIX
RAM 00002400 00001000 00000278 00000d88 RWIX
FLASH 00008000 00007f80 00002662 0000591e RWIX
INT00 0000ff80 00000002 00000000 00000002 RWIX
INT01 0000ff82 00000002 00000000 00000002 RWIX
INT02 0000ff84 00000002 00000000 00000002 RWIX
INT03 0000ff86 00000002 00000000 00000002 RWIX
INT04 0000ff88 00000002 00000000 00000002 RWIX
INT05 0000ff8a 00000002 00000000 00000002 RWIX
INT06 0000ff8c 00000002 00000000 00000002 RWIX
INT07 0000ff8e 00000002 00000000 00000002 RWIX
INT08 0000ff90 00000002 00000000 00000002 RWIX
INT09 0000ff92 00000002 00000000 00000002 RWIX
INT10 0000ff94 00000002 00000000 00000002 RWIX
So, where is that address even coming from? Why is it putting constants in a hole?
I've tried both small and large memory models, too. Makes no difference!