Skip to content

Commit

Permalink
Move Nucleo flash base back to 0x08000000 for bootloader
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jun 12, 2024
1 parent 0586765 commit 962a461
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions boards/NUCLEOF401RE.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'package' : "LQFP64",
'ram' : 96, # 0x0001 8000 long, from 0x2000 0000 to 0x2001 7FFF
'flash' : 512, # 0x0008 0000 long, from 0x0800 0000 to 0x0807 FFFF
'flash_base' : 0x08000000, # default is 0, but 0x08000000 is needed to allow Nucleo mass storage STLink to accept firmware. Fails with ESPR_PACKED_SYMPTR
'speed' : 84,
'usart' : 6,
'spi' : 4,
Expand Down
1 change: 1 addition & 0 deletions boards/NUCLEOF411RE.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'package' : "LQFP64",
'ram' : 128, # 0x0001 8000 long, from 0x2000 0000 to 0x2001 7FFF
'flash' : 512, # 0x0008 0000 long, from 0x0800 0000 to 0x0807 FFFF
'flash_base' : 0x08000000, # default is 0, but 0x08000000 is needed to allow Nucleo mass storage STLink to accept firmware. Fails with ESPR_PACKED_SYMPTR
'speed' : 100,
'usart' : 6,
'spi' : 4,
Expand Down
17 changes: 10 additions & 7 deletions scripts/build_linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# ----------------------------------------------------------------------------------------
# Reads board information from boards/BOARDNAME.py and uses it to generate
# Reads board information from boards/BOARDNAME.py and uses it to generate
# a linker file
# ----------------------------------------------------------------------------------------
import subprocess;
Expand Down Expand Up @@ -75,6 +75,9 @@ def codeOut(s): linkerFile.write(s+"\n");
RAM_SIZE = board.chip["ram"]*1024;
FLASH_SIZE = board.chip["flash"]*1024;

if "flash_base" in board.chip:
FLASH_BASE = board.chip["flash_base"]

# Beware - on some devices (the STM32F4) the memory is divided into two non-continuous blocks
if board.chip["family"]=="STM32F4" and RAM_SIZE > 128*1024:
RAM_SIZE = 128*1024
Expand All @@ -83,8 +86,8 @@ def codeOut(s): linkerFile.write(s+"\n");
# 96k at 0x20000000
# 32k at 0x10000000
# Today, the 32k part won't be used. In the future, it can be
# used for example for the stack. In this case, need to :
# _estack = 0x10008000;
# used for example for the stack. In this case, need to :
# _estack = 0x10008000;
# and add the RAM in MEMORY table.
if board.chip["part"].startswith("STM32L476") and RAM_SIZE > 96*1024:
RAM_SIZE = 96*1024
Expand Down Expand Up @@ -151,10 +154,10 @@ def codeOut(s): linkerFile.write(s+"\n");

codeOut("""
. = ALIGN(4);
*(.text)
*(.text*)
*(.rodata)
*(.rodata*)
*(.text)
*(.text*)
*(.rodata)
*(.rodata*)
. = ALIGN(4);
_etext = .;
Expand Down

0 comments on commit 962a461

Please sign in to comment.