File tree Expand file tree Collapse file tree 7 files changed +18
-2
lines changed
tools/build_script_generator Expand file tree Collapse file tree 7 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,8 @@ def post_build(env):
118
118
if subs ["core" ].startswith ("cortex-m" ):
119
119
# get memory information
120
120
subs ["memories" ] = env .query ("::memories" )
121
+ subs ["flash_offset" ] = env .get (":platform:cortex-m:linkerscript.flash_offset" , 0 )
122
+ subs ["flash_address" ] = hex (0x08000000 + subs ["flash_offset" ])
121
123
else :
122
124
subs ["memories" ] = []
123
125
# Set these substitutions for all templates
Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ def post_build(env):
55
55
subs ["uf2mem" ] = ["{:#x}:{:#x}:{}" .format (m ["start" ], m ["start" ] + m ["size" ],
56
56
"CONTENTS" if "flash" in m ["name" ] else "NO_CONTENTS" )
57
57
for m in subs ["memories" ]]
58
+ subs ["flash_offset" ] = env .get (":platform:cortex-m:linkerscript.flash_offset" , 0 )
59
+ subs ["flash_address" ] = hex (0x08000000 + subs ["flash_offset" ])
58
60
else :
59
61
subs ["memories" ] = []
60
62
# Add SCons specific data
Original file line number Diff line number Diff line change @@ -117,9 +117,10 @@ program-jlink: build
117
117
@$(PYTHON3 ) -m modm_tools.jlink -device $(MODM_JLINK_DEVICE ) $(ELF_FILE )
118
118
119
119
delay? =5
120
+ CONFIG_FLASH_ADDRESS? =0x08000000
120
121
.PHONY : program-dfu
121
122
program-dfu : bin
122
- @dfu-util -v -E$(delay ) -R -i 0 -a 0 -s 0x08000000 :leave -D $(BIN_FILE )
123
+ @dfu-util -v -E$(delay ) -R -i 0 -a 0 -s $( CONFIG_FLASH_ADDRESS ) :leave -D $(BIN_FILE )
123
124
%#
124
125
%% if platform in ["sam"]
125
126
.PHONY : program-bossac
Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ MODM_GDB_COMMANDS = -x $(MODM_PATH)/gdbinit -ex "dir $(GCC_BASE)" -ex "modm_setu
47
47
MODM_GDB_COMMANDS_OPENOCD = -x $(MODM_PATH)/gdbinit_openocd
48
48
MODM_GDB_COMMANDS_JLINK = -x $(MODM_PATH)/gdbinit_jlink
49
49
MODM_GDB_COMMANDS_BMP = -x $(MODM_PATH)/gdbinit_bmp
50
+ CONFIG_FLASH_OFFSET := {{ flash_offset }}
51
+ CONFIG_FLASH_ADDRESS := {{ flash_address }}
50
52
%% if platform == "sam"
51
53
%% if bossac_offset
52
54
MODM_BOSSAC_OFFSET := {{ bossac_offset }}
Original file line number Diff line number Diff line change @@ -163,6 +163,8 @@ def post_build(env):
163
163
if subs ["core" ].startswith ("cortex-m" ):
164
164
# get memory information
165
165
subs ["memories" ] = env .query ("::memories" )
166
+ subs ["flash_offset" ] = env .get (":platform:cortex-m:linkerscript.flash_offset" , 0 )
167
+ subs ["flash_address" ] = hex (0x08000000 + subs ["flash_offset" ])
166
168
else :
167
169
subs ["memories" ] = []
168
170
# Add SCons specific data
Original file line number Diff line number Diff line change @@ -135,6 +135,12 @@ env.Append(MODM_GDBINIT_OPENOCD = "$BASEPATH/modm/gdbinit_openocd")
135
135
env.Append(MODM_GDBINIT_JLINK = "$BASEPATH/modm/gdbinit_jlink")
136
136
env.Append(MODM_GDBINIT_BMP = "$BASEPATH/modm/gdbinit_bmp")
137
137
env.Append(MODM_GDB_COMMANDS = ["dir $GCC_PATH", "modm_setup_tui"])
138
+
139
+ %% if core.startswith("cortex-m")
140
+ env["CONFIG_FLASH_OFFSET"] = {{ flash_offset }}
141
+ env["CONFIG_FLASH_ADDRESS"] = {{ flash_address }}
142
+ %% endif
143
+
138
144
%% if platform == "sam"
139
145
%% if bossac_offset
140
146
env.Append(MODM_BOSSAC_OFFSET = {{ bossac_offset }})
Original file line number Diff line number Diff line change 27
27
# -----------------------------------------------------------------------------
28
28
def program_dfu (env , source ):
29
29
delay = ARGUMENTS .get ("delay" , "5" )
30
- actionString = 'dfu-util -v -E{} -R -i 0 -a 0 -s 0x08000000:leave -D $SOURCE' .format (delay )
30
+ flash_address = env .get ("CONFIG_FLASH_ADDRESS" , 0x08000000 )
31
+ actionString = 'dfu-util -v -E{} -R -i 0 -a 0 -s {}:leave -D $SOURCE' .format (delay , flash_address )
31
32
return env .AlwaysBuildAction (actionString , "$PROGRAM_DFU_COMSTR" , source )
32
33
33
34
# -----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments