This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new f9d124a4b boot/startup: Update generated linker script for newt size
f9d124a4b is described below

commit f9d124a4be6b7cf5b59766dc6255bb88b968c869
Author: Jerzy Kasenberg <[email protected]>
AuthorDate: Fri Mar 21 11:03:14 2025 +0100

    boot/startup: Update generated linker script for newt size
    
    Autogenerated linker script have BOOT and SLOT0 regions
    specified to avoid potential inconsistency between bootloader
    and application code.
    Fragment of generated linker script for application:
    
    MEMORY
    {
        BOOT (rx!w) : ORIGIN = 0x08000000, LENGTH = 131072
        SLOT0 (rx!w) : ORIGIN = 0x08020000, LENGTH = 786432
        RAM (rwx) : ORIGIN = (0x24000000), LENGTH = ((0x80000) - (768))
        STACK_RAM (rw) : ORIGIN = (0x24000000) + (0x80000) - (768), LENGTH = 
(768)
    }
    SECTIONS
    {
    ...
        .interrupts :
        {
        ...
            __isr_vector_end = .;
        } > SLOT0
        .text :
        {
        ...
        } > SLOT0
    
    SLOT0 is used as destination instead of customary FLASH
    
    For bootloader build regions would be the same but destination
    would be > BOOT
    
    This however confuses newt size that expect FLASH as destination
    when used with newt size -F
    
    This modifies generated linker script in a way that regions
    now have FLASH instead of BOOT or SLOT0 depending on build type
    
    MEMORY
    {
        BOOT (rx!w) : ORIGIN = 0x08000000, LENGTH = 131072
        FLASH (rx!w) : ORIGIN = 0x08020000, LENGTH = 786432
        RAM (rwx) : ORIGIN = (0x24000000), LENGTH = ((0x80000) - (768))
        STACK_RAM (rw) : ORIGIN = (0x24000000) + (0x80000) - (768), LENGTH = 
(768)
    }
    SECTIONS
    {
    ...
        .interrupts :
        {
        ...
            __isr_vector_end = .;
        } > FLASH
        .text :
        {
        ...
        } > FLASH
    
    Signed-off-by: Jerzy Kasenberg <[email protected]>
---
 boot/startup/include/mynewt_config.ld.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/boot/startup/include/mynewt_config.ld.h 
b/boot/startup/include/mynewt_config.ld.h
index f84f4a74b..623b1e51a 100644
--- a/boot/startup/include/mynewt_config.ld.h
+++ b/boot/startup/include/mynewt_config.ld.h
@@ -68,9 +68,11 @@
 #if MYNEWT_VAL_RAM_RESIDENT
 #define MYNEWT_CODE RAM
 #elif MYNEWT_VAL_BOOT_LOADER
-#define MYNEWT_CODE BOOT
+#define BOOT FLASH
+#define MYNEWT_CODE FLASH
 #else
-#define MYNEWT_CODE SLOT0
+#define SLOT0 FLASH
+#define MYNEWT_CODE FLASH
 #endif
 #endif
 

Reply via email to