This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems with placing a variable in a named section with scatter-loading

Hello

I'm having problems placing a variable in a named section with scatter-loading. I'm following Placing functions and data at specific addresses and I can actually see the new section in the map file but then the code is not working:

I have created a section called "CAL" to place some variables. This is my scatter file with the new section in RED;

#! armcc -E --cpu Cortex-M4

#define FLASHX_SECT_SIZE 0x800
#define USERFLASH_BASE_ADDR 0x00080000
#define INTFLASH_BASE_ADDR 0x00000000
#define INTFLASH_SIZE (USERFLASH_BASE_ADDR - INTFLASH_BASE_ADDR)

#define MY_ALIGN(address, alignment) ((address + (alignment-1)) AND ~(alignment-1))

LOAD_REGION_INTFLASH INTFLASH_BASE_ADDR INTFLASH_SIZE
{
VECTORS INTFLASH_BASE_ADDR
{
vectors.o (.vectors_rom,+FIRST)
vectors.o (.cfmconfig)
}

CODE +0
{
* (InRoot$$Sections) ; All library sections for example, __main.o,
; __scatter*.o, __dc*.o, and * Region$$Table
* (KERNEL)
* (TEXT)
* (+RO)
}

; make sure this alignment matches the alignment in kernel_data.s in the bsp
FLASHX_START MY_ALIGN(ImageLimit(CODE), FLASHX_SECT_SIZE)
{
* (FLASHX)
}

CALIBRATIONS 0x0007FC00 0x400
{
calibrations.o
*(CAL)
}

DATA 0x1FFF0000
{

* (+RW)
* (+ZI)
}

USB_BDT MY_ALIGN(ImageLimit(DATA), 512)
{
* (.usb_bdt)
}

KERNEL_DATA_START MY_ALIGN(ImageLimit(USB_BDT), 0x10)
{
* (KERNEL_DATA_START) ; start of kernel data
}

// KERNEL_DATA_END 0x20007FF0 ; RAM_END
KERNEL_DATA_END 0x2000FFF0 ; RAM_END
{
* (KERNEL_DATA_END) ; end of kernel data
}

; mem_init writes a storeblock_struct at the end of kernel data,
; max size 32 bytes, so use 0x100 offset
// BOOT_STACK_ADDR 0x20007EF0
BOOT_STACK_ADDR 0x2000FEF0
{
* (BOOT_STACK)
}

ARM_LIB_STACKHEAP 0x2000FEE0 EMPTY 0x04
{
}
}

And I create then a file called "calibrations.c" with a variable declared like this:

const uint64_t device_id __attribute__((section("CAL"))) = 0xA0CDE48B14284E80;

And I can see that section properly being added to the map file:

Execution Region CALIBRATIONS (Exec base: 0x0007fc00, Load base: 0x0004fd70, Size: 0x00000008, Max: 0x00000400, ABSOLUTE)
Exec Addr Load Addr Size Type Attr Idx E Section Name Object
0x0007fc00 0x0004fd70 0x00000008 Data RO 3818 CAL calibrations.o

And the variable is placed on the correct address:

wbid_mac_address                         0x0007fc00   Data           8  calibrations.o(CAL)

But the code is getting stuck in this part:

What else should I do?

Parents Reply Children
No data