initial commit

This commit is contained in:
mykola2312 2022-04-16 22:37:03 +03:00
commit 8053d96def
4 changed files with 42 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.o
*.elf
*.bin

7
Makefile Normal file
View file

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

25
core.S Normal file
View file

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

7
linker.ld Normal file
View file

@ -0,0 +1,7 @@
_estack = 0x20001000;
MEMORY
{
FLASH ( rx ) : ORIGIN = 0x08000000, LENGTH = 1024K
RAM ( rxw ) : ORIGIN = 0x20000000, LENGTH = 256K
}