Closed mintisan closed 6 months ago
hi, debugging is currently experimentally only supported on the add/debugging_pyocd
branch of shadow578/platform-hc32f46x
repo.
to use debugging, you have to update the platform
entry to use the correct branch like so:
[env:my_env]
platform = https://github.com/shadow578/platform-hc32f46x/archive/refs/heads/add/debugging_pyocd.zip
# ...
please note that the debugging support is still experimental, so support is limited.
as a side note: when using cmsis-dap
as debug tool, you don't need to set debug_port = COM9
and upload_port = COM9
.
@shadow578 Thanks for your reply.
I can upload successfully when used you debugging_pyocd branch.
It seems from the logs that the upload was successful, but it did not take effect in reality [possibly due to incorrect flash address?]. This is because I changed the blinking interval of the LED, but there was no change after downloading and restarting.
* The terminal process "C:\Users\mintisan\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload', '--upload-port', 'COM9'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
* Executing task: C:\Users\mintisan\.platformio\penv\Scripts\platformio.exe run --target upload --upload-port COM9
Processing myenv (platform: https://github.com/shadow578/platform-hc32f46x/archive/refs/heads/add/debugging_pyocd.zip; framework: ddl; board: generic_hc32f460)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/hc32f46x/generic_hc32f460.html
PLATFORM: HC32F46X (1.0.0) > Generic HC32F460 Series
HARDWARE: 8MHz, 188KB RAM, 256KB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, stlink)
PACKAGES:
- framework-arduino-hc32f46x @ 1.1.0+sha.d89fb4b
- framework-hc32f46x-ddl @ 2.2.1
- toolchain-gccarmnoneeabi @ 1.120301.0 (12.3.1)
linker parameters: FLASH_START=0, FLASH_SIZE=262144; BOOT_MODE=1; usable flash size: 262144
Driver Library 'DDL_GPIO_ENABLE' enabled
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
pyocd_load_cmd $PYTHONEXE -m pyocd load --no-wait --target hc32f460xc --base-address 0x0 $SOURCE
Checking size .pio\build\myenv\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 0.0% (used 36 bytes from 192512 bytes)
Flash: [ ] 1.1% (used 2984 bytes from 262144 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap
CURRENT: upload_protocol = cmsis-dap
Uploading .pio\build\myenv\firmware.bin
0001571 I Loading C:\Users\mintisan\workplace\HC32F460_PlatformIO\.pio\build\myenv\firmware.bin at 0x00000000 [load_cmd]
[---|---|---|---|---|---|---|---|---|----]
[========================================]
0001914 I Erased 0 bytes (0 sectors), programmed 0 bytes (0 pages), skipped 3072 bytes (6 pages) at 8.76 kB/s [loader]
=========================================================================== [SUCCESS] Took 3.22 seconds ===========================================================================
Processing ci ()
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UndefinedEnvPlatformError: Please specify platform for 'ci' environment
* The terminal process "C:\Users\mintisan\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload', '--upload-port', 'COM9'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
This is what I used in Keil flash download setting:
Another upload log, not work either.
pyocd_load_cmd $PYTHONEXE -m pyocd load --no-wait --target hc32f460xc --base-address 0x0 $SOURCE
Checking size .pio\build\myenv\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 0.0% (used 36 bytes from 192512 bytes)
Flash: [ ] 1.1% (used 2984 bytes from 262144 bytes)
Configuring upload protocol...
AVAILABLE: cmsis-dap
CURRENT: upload_protocol = cmsis-dap
Uploading .pio\build\myenv\firmware.bin
0001580 I Loading C:\Users\mintisan\workplace\HC32F460_PlatformIO\.pio\build\myenv\firmware.bin at 0x00000000 [load_cmd]
[---|---|---|---|---|---|---|---|---|----]
[========================================]
0002015 I Erased 8192 bytes (1 sector), programmed 3072 bytes (6 pages), skipped 0 bytes (0 pages) at 6.90 kB/s [loader]
=========================================================================== [SUCCESS] Took 3.33 seconds ===========================================================================
please make sure that you've actually modified the source, as in the log you've posted nothing got compiled... if you're unsure, clean the project before uploading
I have already compiled the elf binary file using your library and
blink
example in PlatformIO, but I cannot download and debug it. The error message is as follows:Here is my .platformio.ini
I can download and debug in Keil, so the driver is ok.