Skip to content

Commit

Permalink
mcu/pic32: Add minimal boot code
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kasjer committed Mar 16, 2024
1 parent bc7c312 commit 43f26eb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions kernel/os/src/arch/pic32/startup/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 43f26eb

Please sign in to comment.