Skip to content

Commit d916081

Browse files
ajaakkohadbridge
authored andcommitted
export: Add debug configuration to Sw4STM32
1 parent 6e6919c commit d916081

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

tools/export/sw4stm32/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from tools.export.gnuarmeclipse import GNUARMEclipse
2121
from tools.export.gnuarmeclipse import UID
2222
from tools.build_api import prepare_toolchain
23-
from sys import flags
23+
from sys import flags, platform
2424

2525
# Global random number generator instance.
2626
u = UID()
@@ -447,6 +447,7 @@ def generate(self):
447447

448448
ctx = {
449449
'name': self.project_name,
450+
'platform': platform,
450451
'include_paths': self.include_path,
451452
'config_header': config_header,
452453
'exclude_paths': '|'.join(self.excluded_folders),
@@ -470,3 +471,5 @@ def generate(self):
470471
self.gen_file('sw4stm32/cproject_common.tmpl', ctx, '.cproject')
471472
self.gen_file('sw4stm32/makefile.targets.tmpl', ctx,
472473
'makefile.targets', trim_blocks=True, lstrip_blocks=True)
474+
self.gen_file('sw4stm32/launch.tmpl', ctx, self.project_name +
475+
' ' + options['debug']['name'] + '.launch')

tools/export/sw4stm32/launch.tmpl

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="fr.ac6.mcu.debug.config.launchConfigurationType">
3+
<stringAttribute key="DEBBUGER_BOARD_NAME" value="{{board_name}}"/>
4+
<stringAttribute key="DEBBUGER_MCU_NAME" value="{{mcu_name}}"/>
5+
<stringAttribute key="fr.ac6.mcu.ide.DBG_DEVICE" value="ST-Link"/>
6+
<stringAttribute key="fr.ac6.mcu.ide.DBG_DEVICE_SHAREABLE_ALLOWED" value="false"/>
7+
<stringAttribute key="fr.ac6.mcu.ide.DBG_INTERFACE" value="SWD"/>
8+
<stringAttribute key="fr.ac6.mcu.ide.DBG_INTERFACE_FREQUENCY" value="4000000.0"/>
9+
<stringAttribute key="fr.ac6.mcu.ide.DBG_LOW_POWER_MODE_ALLOWED" value="true"/>
10+
<stringAttribute key="fr.ac6.mcu.ide.DBG_RESET_MODE" value="connect_under_reset"/>
11+
<stringAttribute key="fr.ac6.mcu.ide.DBG_STOP_WATCHDOG_THEN_HALTED_ALLOWED" value="true"/>
12+
<booleanAttribute key="fr.ac6.mcu.ide.OPENOCD_GENERATOR_OPTION" value="false"/>
13+
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_NAME" value="&quot;${openstm32_openocd_path}{% if platform == 'win32' %}\{% else %}/{% endif %}openocd{% if platform == 'win32' %}.exe{% endif %}&quot;"/>
14+
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_OTHER_OPTIONS" value=""/>
15+
{% set cfg_id = 'debug' %}
16+
{% set opts = options[cfg_id] %}
17+
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_SCRIPT" value="{{opts['name']}}{% if platform == 'win32' %}\{% else %}/{% endif %}{{name}} {{opts['name']}}.cfg"/>
18+
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_SCRIPT_CHOICE" value="automated"/>
19+
<stringAttribute key="fr.ac6.mcu.ide.OPENOCD_SCRIPT_IS_LEGACY" value="false"/>
20+
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.delay" value="3"/>
21+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="true"/>
22+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="true"/>
23+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageFileName" value=""/>
24+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.imageOffset" value=""/>
25+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value="monitor reset halt"/>
26+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
27+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="Generic TCP/IP"/>
28+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadImage" value="true"/>
29+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.loadSymbols" value="true"/>
30+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
31+
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="3333"/>
32+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
33+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
34+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
35+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
36+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
37+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsFileName" value=""/>
38+
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.symbolsOffset" value=""/>
39+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForImage" value="false"/>
40+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useFileForSymbols" value="false"/>
41+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForImage" value="true"/>
42+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useProjBinaryForSymbols" value="true"/>
43+
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.useRemoteTarget" value="true"/>
44+
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="${openstm32_compiler_path}{% if platform == 'win32' %}\{% else %}/{% endif %}arm-none-eabi-gdb"/>
45+
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
46+
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
47+
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
48+
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="{{opts['name']}}{% if platform == 'win32' %}\{% else %}/{% endif %}{{name}}-{{cfg_id}}.elf"/>
49+
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="{{name}}"/>
50+
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
51+
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="fr.ac6.managedbuild.config.gnu.cross.exe.{{cfg_id}}.{{opts['uid']['config']}}"/>
52+
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
53+
<listEntry value="/{{name}}"/>
54+
</listAttribute>
55+
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
56+
<listEntry value="4"/>
57+
</listAttribute>
58+
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
59+
<listEntry value="org.eclipse.debug.ui.launchGroup.{{cfg_id}}"/>
60+
</listAttribute>
61+
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
62+
<stringAttribute key="process_factory_id" value="fr.ac6.mcu.debug.launching.MCUGdbProcessFactory"/>
63+
</launchConfiguration>

0 commit comments

Comments
 (0)