Skip to content

{build.openocdscript} recipe is not expanded properly #1905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
fpistm opened this issue Feb 22, 2023 · 4 comments
Closed
3 tasks done

{build.openocdscript} recipe is not expanded properly #1905

fpistm opened this issue Feb 22, 2023 · 4 comments
Labels
topic: debugger Related to the integrated debugger type: imperfection Perceived defect in any part of project

Comments

@fpistm
Copy link

fpistm commented Feb 22, 2023

Describe the problem

Hi,

we currently experiment the debug support within the Arduino IDE 2.x for the STM32 core.
For this we will provide openocd thanks our package index json file, currently in dev branch:
https://github.com/stm32duino/BoardManagerFiles/blob/dev/package_stmicroelectronics_index.json#L584-L625

Then we have declared the debug part in the platform.txt:

# Debugger configuration (general options)
# ----------------------------------------
# EXPERIMENTAL feature:
# - this is alpha and may be subject to change without notice
debug.executable={build.path}/{build.project_name}.elf
debug.toolchain=gcc
debug.toolchain.path={runtime.tools.xpack-arm-none-eabi-gcc-12.2.1-1.2.path}/bin
debug.toolchain.prefix=arm-none-eabi-
debug.server=openocd
debug.server.openocd.path={runtime.tools.xpack-openocd-0.12.0-1.path}/bin/openocd
debug.server.openocd.scripts_dir={runtime.tools.xpack-openocd-0.12.0-1.path}/openocd/scripts
debug.server.openocd.script={build.openocdscript}

Finally we have defined the build.openocdscript recipe in the boards.txt.
As we have a lot of variant defined, we defined it at variant level:
Example for Nucleo_64 F411RE:

################################################################################
# Nucleo 64 boards

Nucleo_64.name=Nucleo-64

Nucleo_64.build.core=arduino
Nucleo_64.build.board=Nucleo_64
Nucleo_64.build.variant_h=variant_{build.board}.h
Nucleo_64.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial}
Nucleo_64.upload.maximum_size=0
Nucleo_64.upload.maximum_data_size=0

# NUCLEO_F411RE board
Nucleo_64.menu.pnum.NUCLEO_F411RE=Nucleo F411RE
Nucleo_64.menu.pnum.NUCLEO_F411RE.node="NODE_F411RE,NUCLEO"
Nucleo_64.menu.pnum.NUCLEO_F411RE.upload.maximum_size=524288
Nucleo_64.menu.pnum.NUCLEO_F411RE.upload.maximum_data_size=131072
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.mcu=cortex-m4
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.fpu=-mfpu=fpv4-sp-d16
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.float-abi=-mfloat-abi=hard
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.board=NUCLEO_F411RE
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.series=STM32F4xx
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.product_line=STM32F411xE
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.variant=STM32F4xx/F411R(C-E)T
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.cmsis_lib_gcc=arm_cortexM4lf_math
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.openocdscript=board/st_nucleo_f4.cfg

Unfortunately when we launch the debug, the build.openocdscript is not expanded:

[2023-02-22T09:50:32.614Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"C:\\Users\\<username>\\AppData\\Local\\Arduino15\\packages\\STMicroelectronics\\tools\\xpack-openocd\\0.12.0-1/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "c:\\Users\\<username>\\OneDrive - STMicroelectronics\\Documents\\Arduino\\Blink" -f "C:/IDE/arduino-ide/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f {build.openocdscript}
xPack Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64-dirty (2023-01-30-15:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
embedded:startup.tcl:28: Error: Can't find {build.openocdscript}
in procedure 'script' 
at file "embedded:startup.tcl", line 28
[2023-02-22T09:50:32.698Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

If we defined it at the root of the section it works:
Nucleo_64.build.openocdscript=board/st_nucleo_f4.cfg

I tested with arduino-cli debug and both definition works and {build.openocdscript} is porperly expanded. So only the IDE is impacted.

I've also tested to define it at root to use an other recipe (variable) and it does not works with IDE while it works with arduino-cli.

Nucleo_64.build.openocdscript={build.openocdscript_ext}
Nucleo_64.menu.pnum.NUCLEO_F411RE.build.openocdscript_ext=board/st_nucleo_f4.cfg

One strange behavior if it seems some default recipe are expanded by the IDE but not correctly:
ex: {build.variant}
debug.server.openocd.script={build.variant}/{build.openocdscript}
is expanded like this:
-f "STM32C0xx/C031C(4-6)(T-U)/{build.openocdscript}"

but the selected variant should be STM32F4xx/F411R(C-E)T

To reproduce

define {build.openocdscript} in other way.

Expected behavior

Same behavior between arduino-cli and the IDE: {build.openocdscript} properly expanded.

Arduino IDE version

2.0.3

Operating system

Windows

Operating system version

10

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@fpistm fpistm added the type: imperfection Perceived defect in any part of project label Feb 22, 2023
@kittaakos kittaakos added the topic: debugger Related to the integrated debugger label Feb 22, 2023
@kittaakos
Copy link
Contributor

kittaakos commented Feb 22, 2023

I tested with arduino-cli debug and both definition works

Which version of the CLI did you test? IDE2 is still using 0.29.0 CLI.

@kittaakos kittaakos added the status: waiting for information More information must be provided before work can proceed label Feb 22, 2023
@fpistm
Copy link
Author

fpistm commented Feb 22, 2023

I've tested with the last available release 0.30.0.

@fpistm
Copy link
Author

fpistm commented Feb 22, 2023

I've tested with arduino-cli version 0.29.0 and it is properly expanded:
--file "board/st_nucleo_f4.cfg"

@kittaakos kittaakos removed the status: waiting for information More information must be provided before work can proceed label Feb 22, 2023
@kittaakos kittaakos self-assigned this Feb 22, 2023
@per1234 per1234 changed the title [debug]: {build.openocdscript} recipe is not expanded properly {build.openocdscript} recipe is not expanded properly Feb 22, 2023
@kittaakos kittaakos removed their assignment Feb 23, 2024
@fpistm
Copy link
Author

fpistm commented Jul 19, 2024

Hi @kittaakos
Since #2356 is implemented I guess this one is deprecated. I didn't checked if expansion work with new syntax but no more need of it.
So I close this issue.

@fpistm fpistm closed this as completed Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: debugger Related to the integrated debugger type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants