-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support MAX78000EXG+ by disabling the ROM loader
- Loading branch information
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
Binary file modified
BIN
+109 KB
(110%)
MAX78000_MSBL/Docs/Doc_src/MAX78000_Secure_Bootloader_InApplication_Programming.docx
Binary file not shown.
Binary file modified
BIN
+258 KB
(130%)
MAX78000_MSBL/Docs/MAX78000_Secure_Bootloader_InApplication_Programming.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# To run the script: | ||
|
||
# $ openocd -s "${TOOLCHAIN_PATH}/OpenOCD/scripts" -f interface/cmsis-dap.cfg -f target/max78000.cfg | ||
# $ arm-none-eabi-gdb -batch -q -x ROM_loader_disable.gdbscript | ||
|
||
set variable $fctl_base_addr=0x40029000 | ||
set variable $fctl_faddr=$fctl_base_addr+0x00 | ||
set variable $fctl_fcntl=$fctl_base_addr+0x08 | ||
set variable $fctl_acntl=$fctl_base_addr+0x40 | ||
set variable $fctl_fdata0=$fctl_base_addr+0x30 | ||
set variable $fctl_fdata1=$fctl_base_addr+0x34 | ||
set variable $fctl_fdata2=$fctl_base_addr+0x38 | ||
set variable $fctl_fdata3=$fctl_base_addr+0x3C | ||
|
||
define pico | ||
target remote 127.0.0.1:3333 | ||
set verbose off | ||
end | ||
|
||
define mrh | ||
monitor reset halt | ||
end | ||
|
||
define MAX78000 | ||
pico | ||
end | ||
|
||
define lock_otp | ||
# Write acntl to lock OTP | ||
set *$fctl_acntl=0xdeadbeef | ||
end | ||
|
||
define unlock_otp | ||
# First, put otp controller in known lock state. | ||
lock_otp | ||
# Write acntl to unlock OTP | ||
set *$fctl_acntl=0x3a7f5ca3 | ||
set *$fctl_acntl=0xa1e34f20 | ||
set *$fctl_acntl=0x9608b2c1 | ||
end | ||
|
||
# arg0 = address | ||
# arg1 = 32-bit data | ||
# arg2 = 32-bit data | ||
# arg3 = 32-bit data | ||
# arg4 = 32-bit data | ||
define write_flash_128 | ||
# Unlock and Set width to 128 (bit 4 to zero) | ||
set *$fctl_fcntl=*$fctl_fcntl | 0x20000000 | ||
set *$fctl_fcntl=*$fctl_fcntl & ~0x00000010 | ||
# Set address | ||
set *$fctl_faddr=$arg0 | ||
# Set 128-bits of data | ||
set *$fctl_fdata0=$arg1 | ||
set *$fctl_fdata1=$arg2 | ||
set *$fctl_fdata2=$arg3 | ||
set *$fctl_fdata3=$arg4 | ||
# start flash operation | ||
set *$fctl_fcntl=*$fctl_fcntl | 0x20000001 | ||
while (0 != (*$fctl_fcntl & 0x7)) | ||
# Wait for flash write to complete | ||
end | ||
end | ||
|
||
##################################################### | ||
#################### WARNING ######################## | ||
# Executing this function permanently locks the ROM # | ||
# bootloader. This operation cannot be reverted! #### | ||
##################################################### | ||
|
||
define MAX78000_write_bootloader_disable | ||
unlock_otp | ||
write_flash_128 0x00080130 0xFC000001 0x4116FFFF 0xFFFFFC00 0x543E0000 | ||
write_flash_128 0x00080140 0xFC000001 0x4116FFFF 0xFFFFFC00 0x543E0000 | ||
lock_otp | ||
print "Done" | ||
end | ||
|
||
MAX78000 | ||
MAX78000_write_bootloader_disable | ||
|
||
|