int counter, accumulator = 0, limit_value = 1000000;
unsigned char str_aa55[2] = {0xAA,0x55};
unsigned int int_1122334455667788 = 0x11223344;
unsigned int int_55667788 = 0x55667788;
int bss_val;
void main(void)
{
}
-- Clear local RAM
mov ___ghs_ramstart, r6 -- start of local RAM
mov ___ghs_ramend, r7 -- end of local RAM
mov r0, r1
1:
st.dw r0, 0[r6]
addi 8, r6, r6
cmp r7, r6
bl 1b
-- Jump to the HW initialisation function
jarl ___lowinit, lp
-- Jump to the initialisation functions of the library
-- and from there to main()
jr __start
int counter, accumulator = 0, limit_value = 1000000;
unsigned char str_aa55[2] = {0xAA,0x55};
unsigned int int_1122334455667788 = 0x11223344;
unsigned int int_55667788 = 0x55667788;
int bss_val;
/* Init .data and .bss sections */
ldr r0,=init_data_bss
blx r0
void init_data_bss(void)
{
/* ...... */
/* Data */
data_ram = (uint8_t *)__DATA_RAM;
data_rom = (uint8_t *)__DATA_ROM;
data_rom_end = (uint8_t *)__DATA_END;
/* ...... */
/* BSS */
bss_start = (uint8_t *)__BSS_START;
bss_end = (uint8_t *)__BSS_END;
/* ...... */
/* Copy initialized data from ROM to RAM */
while (data_rom_end != data_rom)
{
*data_ram = *data_rom;
data_ram++;
data_rom++;
}
/* ...... */
/* Clear the zero-initialized data section */
while(bss_end != bss_start)
{
*bss_start = 0;
bss_start++;
}
/* ...... */
}
/* Specify the memory areas */
MEMORY
{
/* … */
/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000
/* … */
.data : AT(__DATA_ROM)
{
. = ALIGN(4);
__DATA_RAM = .;
__data_start__ = .; /* Create a global symbol at data start. */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
__data_end__ = .; /* Define a global symbol at data end. */
} > m_data
__DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
__CODE_ROM = __DATA_END; /* Symbol is used by code initialization. */
/* Uninitialized data section. */
.bss :
{
/* This is used by the startup in order to initialize the .bss section. */
. = ALIGN(4);
__BSS_START = .;
__bss_start__ = .;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
__BSS_END = .;
} > m_data_2
.data 0x1fff8400 0x42c load address 0x000009cc
0x1fff8400 . = ALIGN (0x4)
0x1fff8400 __DATA_RAM = .
0x1fff8400 __data_start__ = .
*(.data)
*(.data*)
.data.limit_value
0x1fff8400 0x4 ./src/main.o
0x1fff8400 limit_value
.data.str_aa55
0x1fff8404 0x2 ./src/main.o
0x1fff8404 str_aa55
*fill* 0x1fff8406 0x2
.data.int_11223344
0x1fff8408 0x4 ./src/main.o
0x1fff8408 int_11223344
.data.int_55667788
0x1fff840c 0x4 ./src/main.o
0x1fff840c int_55667788
.bss 0x20000000 0x28
0x20000000 . = ALIGN (0x4)
0x20000000 __BSS_START = .
0x20000000 __bss_start__ = .
*(.bss)
*(.bss*)
.bss.accumulator
0x2000001c 0x4 ./src/main.o
0x2000001c accumulator
*(COMMON)
COMMON 0x20000020 0x8 ./src/main.o
0x20000020 bss_val
0x20000024 counter
0x20000028 . = ALIGN (0x4)
0x20000028 __bss_end__ = .
0x20000028 __BSS_END = .
0x000009cc __DATA_ROM = .
int limit_value = 1000000;
unsigned char str_aa55[2] = {0xAA,0x55};
unsigned int int_1122334455667788 = 0x11223344;
unsigned int int_55667788 = 0x55667788;
如果你喜欢我的文章,请关注,并转发、点赞和在看,这是对我莫大的鼓励!
本文版权归本号所有,同时欢迎各路朋友转载转发。