Skip to content

Commit 2447ecf

Browse files
committed
Updated init.S file, updated Makefile for thumb instructions
1 parent 47117fd commit 2447ecf

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

riscvonpynq/cortexm1/tcm/build/init.S

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.syntax divided
2-
2+
.thumb
33
.section .stack
4-
.align 3
54
#ifdef __STACK_SIZE
65
.equ Stack_Size, (__STACK_SIZE >> 1)
76
#else
@@ -22,9 +21,15 @@
2221

2322

2423
Reset_Handler:
25-
.extern main
26-
// ldr r0, =0x10
27-
// ldr r1, =0xdeadbeef
28-
// str r1, [r0]
29-
ldr r0, =main
30-
bx r0
24+
//.extern main
25+
mov r0, #0
26+
mov r1, #0
27+
mov r2, #20
28+
str r0, [r2]
29+
mov r2, #0
30+
mov r3, #0
31+
mov r4, #0
32+
mov r5, #0
33+
mov r6, #0
34+
mov r7, #0
35+
//bl main

riscvonpynq/cortexm1/tcm/build/makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
STKPTR ?= 0x10000
22
__STACK_SIZE = $(STKPTR)
3-
CFLAGS = -Wall --std=c99 -ffreestanding -nostdlib -marm -mtune=cortex-m1
3+
CFLAGS = -Wall --std=c99 -ffreestanding -nostdlib -mthumb -mcpu=cortex-m1 -msoft-float
44
all: $(TARGET).bin
55

66
init.o: init.S
77
@echo "Building object file $@ for $<"
8-
arm-linux-gnueabihf-gcc -c -Qn -D__STACK_SIZE=$(__STACK_SIZE) -marm -mtune=cortex-m1 $< -o $@
8+
arm-linux-gnueabihf-gcc -c -Qn -D__STACK_SIZE=$(__STACK_SIZE) $(CFLAGS) $< -o $@
99

10-
%.elf: init.o %.o
10+
%.elf: init.o %.o
1111
@echo "Combining object files $< to produce $@"
12-
gcc -static -ffreestanding -nostdlib -marm -Wl,-Bstatic,-T,cortexm1.ld,--build-id=none \
12+
gcc -static $(CFLAGS) -Wl,-Bstatic,-T,cortexm1.ld,--build-id=none \
1313
-mtune=cortex-m1 $^ -o $@
1414

1515
%.o: %.c

0 commit comments

Comments
 (0)