This commit is contained in:
Kris Kwiatkowski 2025-02-19 14:23:20 +00:00
parent 62fd3a825c
commit 331b577ecc
4 changed files with 46 additions and 16 deletions

View File

@ -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

View File

@ -8,19 +8,9 @@ SECTIONS
.magic_header : ALIGN(4) {
LONG(0x88DAD0F2) /* Magic header containing */
LONG(ADDR(.text)) /* Entry point */
} > RAM
.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
}

22
notes Normal file
View File

@ -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"

17
partial.ld Normal file
View File

@ -0,0 +1,17 @@
SECTIONS
{
.text : ALIGN(4) {
*(.text)
*(.rodata)
}
.data : ALIGN(4) {
*(.data)
}
.bss : ALIGN(4) {
*(.bss)
*(COMMON)
}
}