Hi
Got a question around defining variables in 'noinit' ram location. I have defined a section with UNINIT using the following linker code (using the online compiler)..
#! armcc -E
/* Default to no softdevice */
#if !defined(MBED_APP_START)
#define MBED_APP_START 0x0
#endif
#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x80000
#endif
/* Physical RAM */
#define MBED_RAM_PHYSICAL_START 0x20000000
#define MBED_RAM_PHYSICAL_SIZE 0x10000
/* Reserved areas */
#define MBED_RAM_SOFT_DEVICE_SIZE 0x31d0
#define MBED_RAM_UNINIT_AREA_SIZE 1024
/* If app_start is 0, do not set aside space for the softdevice */
#if MBED_APP_START == 0
#define MBED_RAM_START MBED_RAM_PHYSICAL_START
#define MBED_RAM_SIZE MBED_RAM_PHYSICAL_SIZE
#else
#define MBED_RAM_START (MBED_RAM_PHYSICAL_START + MBED_RAM_SOFT_DEVICE_SIZE)
#define MBED_RAM_SIZE (MBED_RAM_PHYSICAL_SIZE - MBED_RAM_SOFT_DEVICE_SIZE)
#endif
#define MBED_RAM0_START MBED_RAM_START
#define MBED_RAM0_SIZE 0xE0
#define MBED_RAM1_START (MBED_RAM0_START + MBED_RAM0_SIZE)
#define MBED_RAM1_SIZE MBED_RAM_UNINIT_AREA_SIZE
#define MBED_RAM2_START (MBED_RAM1_START + MBED_RAM1_SIZE)
#define MBED_RAM2_SIZE (MBED_RAM_SIZE - MBED_RAM0_SIZE - MBED_RAM1_SIZE)
LR_IROM1 MBED_APP_START MBED_APP_SIZE {
ER_IROM1 MBED_APP_START MBED_APP_SIZE {
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM0 MBED_RAM0_START UNINIT MBED_RAM0_SIZE { ;no init section
*(*nvictable)
}
RW_IRAM1 MBED_RAM1_START UNINIT MBED_RAM1_SIZE { ;no init section
*(*noinit)
}
RW_IRAM2 MBED_RAM2_START MBED_RAM2_SIZE {
.ANY (+RW +ZI)
}
}
and this program code
<<code>>
static uint16_t myvar attribute((section("noinit"),zero_init));
<</code>
However, im confused that this variable does not start with a 0 value? Any ideas why it start with a value of 41779 ?
Is it just because the RAM is not zero initialized so its somewhat random?
Thanks
B
Hi
Got a question around defining variables in 'noinit' ram location. I have defined a section with UNINIT using the following linker code (using the online compiler)..
and this program code
<<code>>
static uint16_t myvar attribute((section("noinit"),zero_init)); <</code>However, im confused that this variable does not start with a 0 value? Any ideas why it start with a value of 41779 ?
Is it just because the RAM is not zero initialized so its somewhat random?
Thanks
B