You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2024/03/20 09:42:38 UTC

(mynewt-core) 02/02: mcu/pic32: Add minimal boot code

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

commit c9b0ded843a3a21680d0bf802689f2d92b53090e
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Sat Mar 16 18:45:22 2024 +0100

    mcu/pic32: Add minimal boot code
    
    There is special flash area dedicated to bootloader (0xbfc00000-0xbfc0FF00).
    Code from this area is execute first.
    This is where mcuboot is placed.
    
    It is possible to build application elf that provides minimal
    code that jumps to normal flash area dedicated for applications.
    The elf generated this way can then easyly be used in MPLAB X ide
    instead of command line gdb.
    
    When syscfg has MCU_NO_BOOTLOADER_BUILD set to 1
    additional section is generated that goes to bootloader area of MCU.
---
 kernel/os/src/arch/pic32/startup/crt0.S | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/kernel/os/src/arch/pic32/startup/crt0.S b/kernel/os/src/arch/pic32/startup/crt0.S
index ac30225ab..16634271d 100644
--- a/kernel/os/src/arch/pic32/startup/crt0.S
+++ b/kernel/os/src/arch/pic32/startup/crt0.S
@@ -633,6 +633,25 @@ __crt0_exit:
         .globl __crt0_exit
         .end _main_entry
 
+#if MYNEWT_VAL_MCU_NO_BOOTLOADER_BUILD
+        ##################################################################
+        # This is startup code for no boot loader application.
+        # This jumps from boot flash to program flash.
+        # It is not used for bootload/application build since it would
+        # generate huge image.
+        ##################################################################
+        .section .boot_reset,code
+        .align 2
+        .set reorder
+        .ent _boot_reset
+_boot_reset:
+        la      v0, _app_reset
+        jr      v0
+
+        .align 2
+        .end _boot_reset
+#endif
+
         .section .text.SystemInit,code
         .align 2
         .weak SystemInit