Skip to content

Commit

Permalink
flashstub: Integrated the LMI Flash stub into the Meson build system
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonmux committed Oct 23, 2024
1 parent 7a5ccb0 commit 0e2d983
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
10 changes: 10 additions & 0 deletions src/target/flashstub/lmi.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
MEMORY { sram (rwx): ORIGIN = 0x20000000, LENGTH = 0x00000400 }

SECTIONS
{
.text :
{
KEEP(*(.entry))
*(.text.*, .text)
} > sram
}
38 changes: 30 additions & 8 deletions src/target/flashstub/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Default definitions of the resulting stubs for all this that are harmless for, eg, BMDA
lmi_stub = []
efm32_stub = []
rp2040_stub = []

Expand Down Expand Up @@ -56,14 +57,35 @@ stub_build_args = [
]

# Flash stub for Stellaris/Tiva-C parts
# lmi_stub_elf = executable(
# 'lmi_stub',
# 'lmi.c',
# c_args: [
# '-mcpu=cortex-m4',
# stub_build_args,
# ]
# )
lmi_stub_elf = executable(
'lmi_stub',
'lmi.c',
c_args: [
'-mcpu=cortex-m3',
stub_build_args,
],
link_args: [
'-mcpu=cortex-m3',
stub_build_args,
'-T', '@0@/lmi.ld'.format(meson.current_source_dir()),
],
link_depends: files('lmi.ld'),
pie: false,
install: false,
)

lmi_stub = custom_target(
'lmi_stub-hex',
command: [
hexdump,
'-v',
'-e', '/2 "0x%04X, "',
'@INPUT@'
],
input: lmi_stub_elf,
output: 'lmi.stub',
capture: true,
)

# Flash stub for EFM32 parts
efm32_stub_elf = executable(
Expand Down
2 changes: 1 addition & 1 deletion src/target/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ target_ti = declare_dependency(
'lmi.c',
'msp432e4.c',
'msp432p4.c',
),
) + lmi_stub,
dependencies: target_cortexm,
)

Expand Down

0 comments on commit 0e2d983

Please sign in to comment.