Skip to content

Commit

Permalink
Revert "Revert "Fixes customizble user stack pointer""
Browse files Browse the repository at this point in the history
This reverts commit 0eb1bad.
  • Loading branch information
HAKarlsson committed May 15, 2024
1 parent 0eb1bad commit 49ba163
Show file tree
Hide file tree
Showing 20 changed files with 52 additions and 16 deletions.
11 changes: 3 additions & 8 deletions common/src/start/start.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.globl _start
#define STACK_SIZE 1024
.extern __global_pointer$
.extern __stack_pointer
/* Defines program entry */
.section .init,"ax",@progbits
_start:
Expand All @@ -8,7 +9,7 @@ _start:
.option norelax
la gp,__global_pointer$
.option pop
la sp,__stack_top
la sp,__stack_pointer

la t0,_bss
la t1,_end
Expand All @@ -20,9 +21,3 @@ _start:
call main

1: j 1b

/* Defines stack */
.section .bss,"aw",@nobits
.balign 8
.space STACK_SIZE
__stack_top:
2 changes: 2 additions & 0 deletions projects/demonstrator/app0.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80040000, LENGTH = 0x8000
}

__stack_size = 1024;
2 changes: 2 additions & 0 deletions projects/demonstrator/app1.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80048000, LENGTH = 0x8000
}

__stack_size = 1024;
2 changes: 2 additions & 0 deletions projects/demonstrator/boot.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80010000, LENGTH = 0x10000
}

__stack_size = 1024;
1 change: 0 additions & 1 deletion projects/demonstrator/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ DEPS :=${OBJS:.o=.d}
CFLAGS:=-march=${ARCH} -mabi=${ABI} -mcmodel=${CMODEL} \
-DPLATFORM_${PLATFORM} \
-nostdlib \
-DSTACK_SIZE=1024 \
-Os -g3 -flto \
-I${COMMON_INC} -include ${S3K_CONF_H}

Expand Down
2 changes: 2 additions & 0 deletions projects/demonstrator/crypto.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80028000, LENGTH = 0x8000
}

__stack_size = 1024;
7 changes: 6 additions & 1 deletion projects/demonstrator/default.ld
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ SECTIONS {
_sbss = .;
*(.sbss .sbss.*)
*(.bss .bss.*)
_end = .;
} > RAM

.stach : ALIGN(8) {
. += __stack_size;
__stack_pointer = .;
_end = .;
}
}
2 changes: 2 additions & 0 deletions projects/demonstrator/monitor.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80020000, LENGTH = 0x8000
}

__stack_size = 1024;
2 changes: 2 additions & 0 deletions projects/demonstrator/uartppp.ld
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80030000, LENGTH = 0x8000
}

__stack_size = 1024;
2 changes: 2 additions & 0 deletions projects/hello/app0.ld
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80010000, LENGTH = 0x10000
}

__stack_size = 1024;
2 changes: 2 additions & 0 deletions projects/hello/app1.ld
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80020000, LENGTH = 0x10000
}

__stack_size = 1024;
3 changes: 1 addition & 2 deletions projects/hello/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ DEPS :=${OBJS:.o=.d}
CFLAGS:=-march=${ARCH} -mabi=${ABI} -mcmodel=${CMODEL} \
-DPLATFORM_${PLATFORM} \
-nostdlib \
-DSTACK_SIZE=1024 \
-Os -g3 -flto \
-I${COMMON_INC} -include ${S3K_CONF_H}

Expand Down Expand Up @@ -56,7 +55,7 @@ ${BUILD}/${PROGRAM}/%.o: ${PROGRAM}/%.c
${OBJCOPY} -O ihex $< $@

%.da: %.elf
${OBJDUMP} -D $< $@
${OBJDUMP} -D $< > $@

.PHONY: all clean

Expand Down
6 changes: 6 additions & 0 deletions projects/hello/default.ld
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ SECTIONS {
*(.bss .bss.*)
_end = .;
} > RAM

.stach : ALIGN(8) {
. += __stack_size;
__stack_pointer = .;
_end = .;
}
}
2 changes: 2 additions & 0 deletions projects/ping-pong/app0.ld
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80010000, LENGTH = 0x10000
}

__stack_size = 1024;
2 changes: 2 additions & 0 deletions projects/ping-pong/app1.ld
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80020000, LENGTH = 0x10000
}

__stack_size = 1024;
3 changes: 1 addition & 2 deletions projects/ping-pong/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ DEPS :=${OBJS:.o=.d}
CFLAGS:=-march=${ARCH} -mabi=${ABI} -mcmodel=${CMODEL} \
-DPLATFORM_${PLATFORM} \
-nostdlib \
-DSTACK_SIZE=1024 \
-Os -g3 -flto \
-I${COMMON_INC} -include ${S3K_CONF_H}

Expand Down Expand Up @@ -56,7 +55,7 @@ ${BUILD}/${PROGRAM}/%.o: ${PROGRAM}/%.c
${OBJCOPY} -O ihex $< $@

%.da: %.elf
${OBJDUMP} -D $< $@
${OBJDUMP} -D $< > $@

.PHONY: all clean

Expand Down
6 changes: 6 additions & 0 deletions projects/ping-pong/default.ld
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ SECTIONS {
*(.bss .bss.*)
_end = .;
} > RAM

.stach : ALIGN(8) {
. += __stack_size;
__stack_pointer = .;
_end = .;
}
}
2 changes: 2 additions & 0 deletions projects/trapped/app0.ld
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MEMORY {
RAM (rwx) : ORIGIN = 0x80010000, LENGTH = 0x10000
}

__stack_size = 1024;
3 changes: 1 addition & 2 deletions projects/trapped/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ DEPS :=${OBJS:.o=.d}
CFLAGS:=-march=${ARCH} -mabi=${ABI} -mcmodel=${CMODEL} \
-DPLATFORM_${PLATFORM} \
-nostdlib \
-DSTACK_SIZE=1024 \
-Os -g3 -flto \
-I${COMMON_INC} -include ${S3K_CONF_H}

Expand Down Expand Up @@ -56,7 +55,7 @@ ${BUILD}/${PROGRAM}/%.o: ${PROGRAM}/%.c
${OBJCOPY} -O ihex $< $@

%.da: %.elf
${OBJDUMP} -D $< $@
${OBJDUMP} -D $< > $@

.PHONY: all clean

Expand Down
6 changes: 6 additions & 0 deletions projects/trapped/default.ld
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,10 @@ SECTIONS {
*(.bss .bss.*)
_end = .;
} > RAM

.stach : ALIGN(8) {
. += __stack_size;
__stack_pointer = .;
_end = .;
}
}

0 comments on commit 49ba163

Please sign in to comment.