diff --git a/src/target/flashstub/lmi.ld b/src/target/flashstub/lmi.ld new file mode 100644 index 00000000000..194c0ec136c --- /dev/null +++ b/src/target/flashstub/lmi.ld @@ -0,0 +1,10 @@ +MEMORY { sram (rwx): ORIGIN = 0x20000000, LENGTH = 0x00000400 } + +SECTIONS +{ + .text : + { + KEEP(*(.entry)) + *(.text.*, .text) + } > sram +} diff --git a/src/target/flashstub/meson.build b/src/target/flashstub/meson.build index 3f6769fa5cf..90ea0edd91a 100644 --- a/src/target/flashstub/meson.build +++ b/src/target/flashstub/meson.build @@ -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 = [] @@ -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( diff --git a/src/target/meson.build b/src/target/meson.build index 4bb0f031e6b..070f4da6cfe 100644 --- a/src/target/meson.build +++ b/src/target/meson.build @@ -327,7 +327,7 @@ target_ti = declare_dependency( 'lmi.c', 'msp432e4.c', 'msp432p4.c', - ), + ) + lmi_stub, dependencies: target_cortexm, )