platformio / platform-titiva

TI TIVA: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/titiva
Apache License 2.0
10 stars 10 forks source link

SRST Error & OpenOCD Warning #11

Closed astroesteban closed 3 years ago

astroesteban commented 3 years ago

Hey yall,

I'm having a bit of an issue with flashing my TM4C123 board. The first is the warning from OpenOCD to switch to board/ti_ek-tm4c123gxl.cfg. Is there a way I can configure that in platformio? Or is that fixed in a newer release?

Second, I get a bunch of Error: SRST error but the board does get flashed. I can even launch the debugger and step through the code. Is this error something that can be easily fixed on my end?

platform.ini File

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:lptm4c1230c3pm]
platform = titiva
board = lptm4c1230c3pm
framework = libopencm3
debug_tool = ti-icdi
upload_protocol = ti-icdi

Terminal Output

> Executing task: pio run --target upload <

Processing lptm4c1230c3pm (platform: titiva; board: lptm4c1230c3pm; framework: libopencm3)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/titiva/lptm4c1230c3pm.html
PLATFORM: TI TIVA (3.0.0) > TI LaunchPad (Tiva C) w/ tm4c123 (80MHz)
HARDWARE: LPTM4C1230C3PM 80MHz, 32KB RAM, 256KB Flash
DEBUG: Current (ti-icdi) On-board (ti-icdi)
PACKAGES: 
 - framework-libopencm3 1.10000.200730 (1.0.0) 
 - tool-openocd 2.1000.200630 (10.0) 
 - toolchain-gccarmnoneeabi 1.40804.0 (4.8.4)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/lptm4c1230c3pm/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.0% (used 0 bytes from 32768 bytes)
Flash: [          ]   0.3% (used 784 bytes from 262144 bytes)
Configuring upload protocol...
AVAILABLE: ti-icdi
CURRENT: upload_protocol = ti-icdi
Uploading .pio/build/lptm4c1230c3pm/firmware.bin
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-12:31)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

WARNING: board/ek-tm4c123gxl.cfg is deprecated, please switch to board/ti_ek-tm4c123gxl.cfg
Error: SRST error
Error: SRST error
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0000078c msp: 0x20008000
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
Error: SRST error
shutdown command invoked
daborbor commented 3 years ago

Have you managed to fix the problem?

astroesteban commented 3 years ago

Yes I did. Thanks! I just updated the config file OpenOCD used.

MartinPetrei commented 3 years ago

@astroesteban can you give some details about how to update the config file for OpenOCD? Thanks.

amidg commented 3 years ago

@astroesteban can you please, elaborate on you solution? I have TM4C123GH6PM Tiva-C board and I have updated my .json file in the PlatformIO eventually creating another custom board variant. Now I just get SRST error with no upload.

astroesteban commented 3 years ago

Hey @amidg all I did was change the configuration file OpenOCD loads from board/ek-tm4c123gxl.cfg to board/ti_ek-tm4c123gxl.cfg. You can see more information on how that's changed here. The System Reset (SRST) is a pretty finicky thing. You can read up about it here.

Since posting this issue OpenOCD released version 0.11.0 which seems to be working great for me. I don't know what version PlatformIO ships with but if there's a way to upgrade to the latest OpenOCD (found here I'd recommend you do that too.

Let me know if that works for you. I've since switched over to a CMake + VS Code + Cortex Debug (with OpenOCD & GDB) setup.

amidg commented 3 years ago

Hey @amidg all I did was change the configuration file OpenOCD loads from board/ek-tm4c123gxl.cfg to board/ti_ek-tm4c123gxl.cfg. You can see more information on how that's changed here. The System Reset (SRST) is a pretty finicky thing. You can read up about it here.

Since posting this issue OpenOCD released version 0.11.0 which seems to be working great for me. I don't know what version PlatformIO ships with but if there's a way to upgrade to the latest OpenOCD (found here I'd recommend you do that too.

Let me know if that works for you. I've since switched over to a CMake + VS Code + Cortex Debug (with OpenOCD & GDB) setup.

I have updated both Windows and Linux machine with the OpenOCD 0.11.0 from your link, still the same result. I get SRST error still. I have also updated ti_ek-tm4c123gxl.cfg file with the following lines to test what VS Code terminal will show: source [find interface/ti-icdi.cfg] echo "interface ti-icdi.cfg is working, OK!"

transport select hla_jtag echo "hla_jtag working ok!"

set WORKAREASIZE 0x8000 set CHIPNAME tm4c123gh6pm echo "board MCU design is set correctly"

source [find target/stellaris.cfg] echo "stellaris.cfg is working correctly"

It does not even reach that point because SRST error seems to appear before this file is even executed. Any thoughts?

astroesteban commented 3 years ago

@amidg Gotcha. I ran that on Mac OS and it seemed to fix it. I'll give it another try this weekend and report back to you.

Alighorab commented 2 years ago

Hey @amidg all I did was change the configuration file OpenOCD loads from board/ek-tm4c123gxl.cfg to board/ti_ek-tm4c123gxl.cfg. You can see more information on how that's changed here. The System Reset (SRST) is a pretty finicky thing. You can read up about it here. Since posting this issue OpenOCD released version 0.11.0 which seems to be working great for me. I don't know what version PlatformIO ships with but if there's a way to upgrade to the latest OpenOCD (found here I'd recommend you do that too. Let me know if that works for you. I've since switched over to a CMake + VS Code + Cortex Debug (with OpenOCD & GDB) setup.

I have updated both Windows and Linux machine with the OpenOCD 0.11.0 from your link, still the same result. I get SRST error still. I have also updated ti_ek-tm4c123gxl.cfg file with the following lines to test what VS Code terminal will show: source [find interface/ti-icdi.cfg] echo "interface ti-icdi.cfg is working, OK!"

transport select hla_jtag echo "hla_jtag working ok!"

set WORKAREASIZE 0x8000 set CHIPNAME tm4c123gh6pm echo "board MCU design is set correctly"

source [find target/stellaris.cfg] echo "stellaris.cfg is working correctly"

It does not even reach that point because SRST error seems to appear before this file is even executed. Any thoughts?

I kinda figured out what the problem is. After uploading, OPENOCD resets the MCU, I noticed if I activate PLL the reset stage fails. So, I added this line to platformio.ini:

upload_command = openocd -f /usr/share/openocd/scripts/board/ti_ek-tm4c123gxl.cfg -c "program .pio/build/lptm4c123gh6pm/firmware.elf verify exit"

And I do the reset myself on the board.