commit 8053d96def0c412152ce073768f40cb846761d37 Author: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Sat Apr 16 22:37:03 2022 +0300 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7cf238f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.o +*.elf +*.bin diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1a7e319 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +debug: + openocd -f interface/stlink.cfg -f target/stm32f4x.cfg + +all: + arm-none-eabi-gcc -x assembler-with-cpp -c -O0 -mcpu=cortex-m0 -mthumb -Wall core.S -o core.o + arm-none-eabi-gcc core.o -mcpu=cortex-m0 -mthumb -Wall -nostdlib -lgcc -T./linker.ld -o main.elf + arm-none-eabi-objcopy -O binary main.elf main.bin \ No newline at end of file diff --git a/core.S b/core.S new file mode 100644 index 0000000..c667f8d --- /dev/null +++ b/core.S @@ -0,0 +1,25 @@ +.syntax unified +.cpu cortex-m0 +.fpu softvfp +.thumb + +.global vtable +.global reset_handler + +.type vtable, %object +vtable: + .word _estack + .word reset_handler +.size vtable, .-vtable + +.type reset_handler, %function +reset_handler: + LDR r0, =_estack + MOV sp, r0 + + LDR r7, =0xDEADBEEF + MOVS r0, #0 + main_loop: + ADDS r0, r0, #1 + B main_loop +.size reset_handler, .-reset_handler diff --git a/linker.ld b/linker.ld new file mode 100644 index 0000000..bf67748 --- /dev/null +++ b/linker.ld @@ -0,0 +1,7 @@ +_estack = 0x20001000; + +MEMORY +{ + FLASH ( rx ) : ORIGIN = 0x08000000, LENGTH = 1024K + RAM ( rxw ) : ORIGIN = 0x20000000, LENGTH = 256K +} \ No newline at end of file