diff --git a/Makefile b/Makefile index 9c4918c..bc9fc67 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ all: - arm-none-eabi-gcc -ggdb -mcpu=Cortex-M4 -mthumb -Tlibpqscheme.ld -nostartfiles -o libpqscheme_test.elf libpqscheme_test.c -Iruntime_mps2/out/an386/pack/include -L/home/kris/repos/pqshield/epcc/out/armv7e-m/lib -I/home/kris/repos/pqshield/epcc/out/armv7e-m/inc -lmlkem -lsha3 -lcommon + arm-none-eabi-gcc -ggdb -mcpu=Cortex-M4 -mthumb -r -nostartfiles -o libpqscheme_test.o libpqscheme_test.c -Iruntime_mps2/out/an386/pack/include -I/home/kris/repos/pqshield/epcc/out/armv7e-m/inc + arm-none-eabi-gcc -ggdb -mcpu=Cortex-M4 -mthumb -Tlibpqscheme.ld -nostartfiles -o libpqscheme_test.elf libpqscheme_test.o -L/home/kris/repos/pqshield/epcc/out/armv7e-m/lib -lmlkem -lsha3 -lcommon arm-none-eabi-gcc -ggdb -mcpu=Cortex-M4 -mthumb -Truntime_mps2/out/an386/pack/lib/mps2.ld -nostartfiles -o runner.elf runner.c -Lruntime_mps2/out/an386/pack/lib -lmps2-an386_runtime -Iruntime_mps2/out/an386/pack/include arm-none-eabi-ar rcs runner runner.elf arm-none-eabi-objcopy -O binary libpqscheme_test.elf libpqscheme_test.bin diff --git a/libpqscheme.ld b/libpqscheme.ld index edbf1a2..0dd9efb 100644 --- a/libpqscheme.ld +++ b/libpqscheme.ld @@ -7,20 +7,10 @@ SECTIONS { .magic_header : ALIGN(4) { LONG(0x88DAD0F2) /* Magic header containing */ - LONG(ADDR(.text)) /* Entry point */ - } > RAM + LONG(ADDR(.text)) /* Entry point */ + } - .text : ALIGN(4) { - *(.text) - *(.rodata) - } > RAM - - .data : ALIGN(4) { - *(.data) - } > RAM - - .bss : ALIGN(4) { - *(.bss) - *(COMMON) - } > RAM + .text : { *(.text) *(.rodata) } > RAM + .data : { *(.data) } > RAM + .bss : { *(.bss) *(COMMON) } > RAM } diff --git a/notes b/notes new file mode 100644 index 0000000..d285547 --- /dev/null +++ b/notes @@ -0,0 +1,22 @@ +pmemsave 0x20000000 0x00800000 x.bin + +00000030 17 00 16 00 f2 d0 da 88 10 00 00 00 f3 d0 da 88 |................| +00000040 00 00 00 00>04 b0 2d e5 00 b0 8d e2 1c 30 9f e5 |......-......0..| +00000050 03 30 8f e0 00 20 93 e5 14 30 9f e5 03 30 82 e0 |.0... ...0...0..| +00000060 03 00 a0 e1 00 d0 8b e2 04 b0 9d e4 1e ff 2f e1 |............../.| + + +# Use nc -U /tmp/file to connect and dump section of the memory, when qemu +# runs in monitor "-monitor unix:/tmp/qemu-monitor,server,nowait" +pmemsave 0x20000000 0x00800000 x.bin + +# disassemble +arm-none-eabi-objdump -d -j .text libpqscheme_test.elf > text_dump.bin + +# dump section +arm-none-eabi-objcopy -O binary --only-section=.text libpqscheme_test.elf text_section.bin + +# Addresses +arm-none-arm-none-eabi-objdump -h libpqscheme_test.elf + +# When in GDB "-S -gdb tcp::1234" diff --git a/partial.ld b/partial.ld new file mode 100644 index 0000000..84b3ddb --- /dev/null +++ b/partial.ld @@ -0,0 +1,17 @@ +SECTIONS +{ + + .text : ALIGN(4) { + *(.text) + *(.rodata) + } + + .data : ALIGN(4) { + *(.data) + } + + .bss : ALIGN(4) { + *(.bss) + *(COMMON) + } +}