From 18bfd658ee9a4924f68e2b481859e3fb3bebe77a Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 5 Jul 2025 16:24:48 -0500 Subject: [PATCH 1/4] pbio/platform/ev3/platform.ld: drop .startcode section This source file for startup.o is empty, so this does nothing. Also, in this script, we use ENTRY() to determine the entry point, so we don't need to do anything special for the first section in RAM. --- lib/pbio/platform/ev3/platform.ld | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/pbio/platform/ev3/platform.ld b/lib/pbio/platform/ev3/platform.ld index ab2ffa4dd..181681a54 100644 --- a/lib/pbio/platform/ev3/platform.ld +++ b/lib/pbio/platform/ev3/platform.ld @@ -15,12 +15,6 @@ pbdrv_stack_end = ORIGIN(DDR) + LENGTH(DDR) - 4; SECTIONS { - .startcode : - { - . = ALIGN(4); - *startup.o (.text) - } > DDR - .text : { . = ALIGN(4); From bb5de8af921c4cd432c98e99ee49a75667dae027 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 5 Jul 2025 16:29:59 -0500 Subject: [PATCH 2/4] pbio/platform/ev3/platform.ld: combine NOLOAD sections We already have a .noinit section, so we can drop all of the other named NOLOAD sections and just use that one. --- lib/pbio/drv/display/display_ev3.c | 4 ++-- lib/pbio/platform/ev3/platform.ld | 8 -------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/pbio/drv/display/display_ev3.c b/lib/pbio/drv/display/display_ev3.c index 4e49f07be..c8a306646 100644 --- a/lib/pbio/drv/display/display_ev3.c +++ b/lib/pbio/drv/display/display_ev3.c @@ -134,7 +134,7 @@ PROCESS(pbdrv_display_ev3_init_process, "st7586s"); * * Non-atomic updated by the application are allowed. */ -static uint8_t pbdrv_display_user_frame[PBDRV_CONFIG_DISPLAY_NUM_ROWS][PBDRV_CONFIG_DISPLAY_NUM_COLS] __attribute__((section(".pbdrv_display_user_frame"), used)); +static uint8_t pbdrv_display_user_frame[PBDRV_CONFIG_DISPLAY_NUM_ROWS][PBDRV_CONFIG_DISPLAY_NUM_COLS] __attribute__((section(".noinit"), used)); /** * Flag to indicate that the user frame has been updated and needs to be @@ -164,7 +164,7 @@ static bool pbdrv_display_user_frame_update_requested = false; * Even in monochrome mode, you can only have 3 pixels per byte, so there is no * savings in using it. We might as well support gray scale. */ -static uint8_t st7586s_send_buf[ST7586S_NUM_COL_TRIPLETS * ST7586S_NUM_ROWS] __attribute__((section(".st7586s_send_buf"), used)); +static uint8_t st7586s_send_buf[ST7586S_NUM_COL_TRIPLETS * ST7586S_NUM_ROWS] __attribute__((section(".noinit"), used)); /** * Encode a triplet of pixels into a single byte in the format descrived above. diff --git a/lib/pbio/platform/ev3/platform.ld b/lib/pbio/platform/ev3/platform.ld index 181681a54..8b8575c90 100644 --- a/lib/pbio/platform/ev3/platform.ld +++ b/lib/pbio/platform/ev3/platform.ld @@ -45,14 +45,6 @@ SECTIONS _pru0_end = .; } >DDR - .display_frames (NOLOAD) : - { - . = ALIGN(4); - *(.pbdrv_display_user_frame) - . = ALIGN(4); - *(.st7586s_send_buf) - } > DDR - /* Uninitialized (not zeroed at startup) data section */ .noinit (NOLOAD) : From 5d3e03eaa8e1e1360e655757c4e53756b62dd781 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 5 Jul 2025 16:32:26 -0500 Subject: [PATCH 3/4] pbio/platform/ev3/platform.ld: reserve more for stack The start.S script is already reserving 2.8M for the stack via: .set UND_STACK_SIZE, 0x50000 .set ABT_STACK_SIZE, 0x50000 .set FIQ_STACK_SIZE, 0xF0000 .set IRQ_STACK_SIZE, 0xF0000 .set SVC_STACK_SIZE, 0x50000 And expects a bit more for the main stack. 64K was not nearly enough to cover this. 4M should be more than enough. --- lib/pbio/platform/ev3/platform.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pbio/platform/ev3/platform.ld b/lib/pbio/platform/ev3/platform.ld index 8b8575c90..7efaeebec 100644 --- a/lib/pbio/platform/ev3/platform.ld +++ b/lib/pbio/platform/ev3/platform.ld @@ -10,7 +10,7 @@ MEMORY DDR (rwx) : ORIGIN = 0xC0008000, LENGTH = (64M - 0x8000) } -_minimal_stack_size = 64K; +_minimal_stack_size = 4M; pbdrv_stack_end = ORIGIN(DDR) + LENGTH(DDR) - 4; SECTIONS From 01c2fea31cb349da923df6764c670d879425492e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 5 Jul 2025 16:41:43 -0500 Subject: [PATCH 4/4] pbio/platform/ev3: drop startup.s This file is empty because we need a .S file for startup on EV3 instead of a .s file. So we can add a conditional to the makefile to to not compile this file on the EV3. --- bricks/_common/arm_none_eabi.mk | 2 ++ lib/pbio/platform/ev3/startup.s | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 lib/pbio/platform/ev3/startup.s diff --git a/bricks/_common/arm_none_eabi.mk b/bricks/_common/arm_none_eabi.mk index 3fefa84bf..3361facb9 100644 --- a/bricks/_common/arm_none_eabi.mk +++ b/bricks/_common/arm_none_eabi.mk @@ -510,7 +510,9 @@ NXOS_SRC_S = $(addprefix lib/pbio/platform/nxt/nxos/,\ irq.s \ ) +ifneq ($(PB_MCU_FAMILY),TIAM1808) SRC_S += lib/pbio/platform/$(PBIO_PLATFORM)/startup.s +endif OBJ = $(PY_O) OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) diff --git a/lib/pbio/platform/ev3/startup.s b/lib/pbio/platform/ev3/startup.s deleted file mode 100644 index 78ce8e6fb..000000000 --- a/lib/pbio/platform/ev3/startup.s +++ /dev/null @@ -1 +0,0 @@ -@* Not used. See start.S