ARM GCC -- First 64KB of application code

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ARM GCC -- First 64KB of application code

Jump to solution
748 Views
ice0
Contributor II

Hi

Does anybody know where is the ASM code for first 64KB of compiled ELF

I'm looking for the code which define magic ELF 0x7F454C46 signature

Linker sets memory:

MEMORY
{
    ROM_VECTORS (rx) : ORIGIN = 0x00000000, LENGTH = 0x00000400
    ROM_FLASH_CFG (rx) : ORIGIN = 0x00000400, LENGTH = 0x00000010
    ROM_TEXT (rx) : ORIGIN = 0x00000410, LENGTH = 512K
    RAM (rw) : ORIGIN = 0x20000000, LENGTH = 192K
}

When I read the ELF file the ROM vectors are located one byte over 64KB

Startup code is:

.cpu cortex-m4
.thumb

.section .vectors, "a"
    .word __stack
    .word _reset
    .word _hang /* NMI */
    .word _hang /* HardFault */
    .word _hang /* MemManage */
    .word _hang /* BusFault */
    .word _hang /* UsageFault */
    .word _hang /* Reserved */
    .word _hang /* Reserved */
    .word _hang /* Reserved */
    .word _hang /* Reserved */
    .word vPortSVCHandler
    .word _hang /* DebugMonitor */
    .word _hang /* Reserved */
    .word xPortPendSVHandler
    .word xPortSysTickHandler

.section .flash_config, "a"
    .long 0xFFFFFFFF
    .long 0xFFFFFFFF
    .long 0xFFFFFFFF
    .long 0xFFFFFFFE

.section .text
.thumb_func
.global _reset
_reset:
    bl disable_wdog
    bl init_data_and_bss
    bl main

.global _exit
_exit:
    b .
 
.global _hang
_hang:
    b .

And the ELF binary:

1:    7f45 4c46 0101 0100 0000 0000 0000 0000           CODE ???
2:   0200 2800 0100 0000 1004 0000 3400 0000           CODE ???
3:   14ec 0200 0002 0005 3400 2000 0400 2800           CODE ???
4:   1100 1000 0100 0000 0000 0100 0000 0000           CODE ???
5:   0000 0000 4000 0000 4000 0000 0400 0000           CODE ???
6:   0000 0100 0100 0000 0004 0100 0004 0000           CODE ???
7:   0004 0000 1000 0000 1000 0000 0400 0000           CODE ???
8:   0000 0100 0100 0000 1004 0100 1004 0000           CODE ???
9:   1004 0000 d82f 0000 d82f 0000 0500 0000             CODE ???
10: 0000 0100 0100 0000 0000 0200 0000 0020           CODE ???
11: e833 0000 0400 0000 d480 0000 0600 0000           CODE ???
12: 0000 0100 0000 0000 0000 0000 0000 0000
13: 0000 0000 0000 0000 0000 0000 0000 0000
14: 0000 0000 0000 0000 0000 0000 0000 0000
15: 0000 0000 0000 0000 0000 0000 0000 0000
16: 0000 0000 0000 0000 0000 0000 0000 0000

...

...

...
4095: 0000 0000 0000 0000 0000 0000 0000 0000
4096: 0000 0000 0000 0000 0000 0000 0000 0000
4097: 0000 0320 1104 0000 1e04 0000 1e04 0000   ROM VECTORS
4098: 1e04 0000 1e04 0000 1e04 0000 1e04 0000   ROM VECTORS
4099: 1e04 0000 1e04 0000 1e04 0000 5105 0000   ROM VECTORS
4100: 1e04 0000 1e04 0000 8907 0000 eb07 0000   ROM VECTORS
4101: 0000 0000 0000 0000 0000 0000 0000 0000

4102: 0000 0000 0000 0000 0000 0000 0000 0000

Does anybody know where I could find a code for first 64KB of compiled ELF ???

Thanks

Ice

0 Kudos
1 Solution
684 Views
mjbcswitzerland
Specialist V

Hi Ice

The ELF header is generated by the output converter and is not part of the code:

https://linux-audit.com/elf-binaries-on-linux-understanding-and-analysis/

Regards

Mark


Complete Kinetis solutions for professional needs, training and support: http://www.utasker.com/kinetis.html
uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market
Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html

Open Source version at https://github.com/uTasker/uTasker-Kinetis

View solution in original post

0 Kudos
1 Reply
685 Views
mjbcswitzerland
Specialist V

Hi Ice

The ELF header is generated by the output converter and is not part of the code:

https://linux-audit.com/elf-binaries-on-linux-understanding-and-analysis/

Regards

Mark


Complete Kinetis solutions for professional needs, training and support: http://www.utasker.com/kinetis.html
uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market
Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html

Open Source version at https://github.com/uTasker/uTasker-Kinetis

0 Kudos