Debug .hex file with STM32CubeIDE - stm32

I am quiet new to STM32 developement.
I made a custom .hex file, which corresponds to my binary file with a CRC at a given address. To achieve this, I followed this instructions.
Right now, I am stuck at step 11, where the author tells STM32CubeIDE to debug current project with its custom .hex file instead of standard .elf file.
My problem is that this instructions are quiet old and IDE's UI is different now. How can I achieve this step with latest STM32CubeIDE version ? (1.6.1 at time of writing)
Thanks.

It is quite simple.
Create HEX
Manually flash it
Start debugging the normal way. Simply do not let openOCD or ST-LinkGDBServer to flash the chip.
Enjoy.

I have got the same problem, and my solution is to use stm32cubeProgrammer. It can't show the debug information, so I use usart to show the CRC result.

Related

Porting of TwinCAT2 to TwinCTA3

I have a running project of twinCAT 2 (made for XP 32bit ) & Its working as required. Now I tried to port this project into TwinCAT3 (windows 10 64bit) for that->
I opened twinCAT 3 Created a new project.
Then add the existing project where I added ".tsm" file of TwinCAT2.
Then I added the PLC file (which have the main program & GUI also)
Then all the mapping for input and output & also changed a few settings in twinCAT for the device.
In the end, I build the program without having any errors.
Then finally I ran the TwinCAT3 program....
The problem I'm facing
If I'm clicking the RUN button TwinCAT3 is getting hanged (don't know the maybe time-related file is creating issue)
I'm not able to see data on GUI (Maybe GUI file not linked with the main program).
Please let me know if any solution you guys have.
Thanks :)
Porting TwinCAT2 plc project with a visualization to TC3 is sometimes a little tricky. You can try to just import the visualization pictures into the plc and let the engineering do the rest automatically (bind libs etc.). Or check the lib-versions of the visu libs manually. Or check the visualization profile in the plc-project properties. In both cases the slogan is "latest greatest" in this scope.
Is the connection to other data from the target also lost? E.g. the current cpu-usage of the cores? If yes, you have a other problem. Mostly endless loop.

U-boot deployment questions

I'am currently developing an application for an embedded system (RTEMS for RPI2). As you may know developing proccess on embedded systems imply:
Modifing the program
Compile it and load it into de SD card
Insert the SD card on the board
It is a tedious process, and you can even break the SD slot for the constant usage. This is the reson why i'am trying to set up a comfortable enviroment for developing and deploying the application on the RPI. My idea is to use Eclipse as IDE for all the proccess (edit, compile and execute). So far these are my ideas for solving the different problems:
Usage of U-boot for loading the application images from TFTP. [That solves the problem of plug & unplug the SD card]
Use CTD eclipse pulgin [That solves the problem of compiling]
Use of Terminal View eclipse plugin instead of putty [That solves the problem of viewing the application console prints]
As you may notice the only problem i have unsolved is the one of executing. The idea is that whenever you compile the compiled file is located at the TFTP server directory, so it is accesible for u-boot client to load. The thing i don´t know how to do is how to tell remotely u-boot to reaload the image (the image would always have the same name). I know i can just simply reset the RPI but i don´t know if that can damage something, and also i'am curious to know if there is a more elegant way to do it.
Another thing i would like to do is to somehow specify if you want to run the application on the target or on a simulator like QEMU.
Thanks in advance

avrdude programmer is not responding when uploading a .hex file

I'm trying to upload a hex file to atmega328 on my arduino UNO board that I builded with eclipse's AVR plugin but when I run avrdude -pm328p -carduino -P/dev/ttyACM0 -b9600 -Uflash:w:/home/bruno/workspace/testAVR/Release/testAVR.hex:a I get avrdude: stk500_recv(): programmer is not responding
I tried to upload a blink led code using arduino IDE and it worked fine.
This is a fairly general error that can be caused by any number of things. Try adding a -vvv flag (or maybe -vvvv) which will give you more verbose output when programming.
One thing to try is hitting the reset button on the Arduino immediately after avrdude writes the first few bytes.
Ensure that there is nothing shorted, and that the Uno has a stable power source. Also, if there is anything connected to the RX/TX pins, that can cause a programming issue.
Make sure you are using the correct programmer, if your Arduino is a clone, you might need -c arduino-ft232r.

Command line arguments for Scratch 1.4

I'm using Scratch 1.4 for preparing a course for children.
The course is about controlling real devices (self built traffic lights, modified toys having motors, sensors, etc.)
For interfacing the hardware I'm using the Remote Sensor Protocol and the control-lines of a RS232 interface (3-in/3-out, all digital).
Everything works great, except small inconveniences:
The children have to do many steps manually:
start scratch first,
load a template project which enables remote sensor protocol and defines variables
accept the warning message notifying, that remote sensor protocol is enabled
start RSP-RS232 proxy
I'd like to simplify it by starting scratch from my tool, ask Scratch to perform steps 2,3 by command-line arguments and finally connect to the RSP port.
Is it possible?
If not, is it hard to implement these parameters in Smalltalk for someone with no Smalltalk experience (but other languages like C++)?
Thank you!
Ok, after some readings I could answer my question.
Bad news is: there is obviously no command line argument in Scratch passing a project-file as a start-project.
However good news is, it is not difficult to change the scratch for own needs. Several projects do it, e.g.:
Scratch 4 Arduino
Scratch GPIO
How to do it is described here:
http://wiki.scratch.mit.edu/wiki/Scratch_1.4_Source_Code
Scratch and Squeak
...
To get started, first copy the Scratch application ("Scratch.exe" or
"Scratch.app") from your normal Scratch folder into the Scratch source
code folder. (The Scratch application is actually just a Squeak
virtual machine, so any recent Squeak virtual machine should also
work.) Also, put copy of the Squeak source code file in that folder if
needed (this file is included in the zip file starting with the 1.4
source release). Finally, drop the file "ScratchSourceCode1.4.image"
onto the Scratch application. The Squeak programming environment will
start up, allowing you to view and modify the Scratch source code.
I was able to disable the dialogue notifying that remote sensors protocol is enabled
and to enable remote sensors at start by default. Took me 2 hours.
P.S.:
For those interested, I host my project here: https://github.com/vheinitz/Qratzfest
As I've found out, my Idea was not new (I've looked for this possibility about 3 years ago, but there was nothing). What is different, the proxy-tool is for PC, and is intended to use any hardware, not dedicated only to a specially firmwared Arduino or PI. Currently only control-pins of a serial interface are supported and linked to fixed names.
Soon it will provide the possibility to map any pin to any Scratch-variable.

Eclipse AVR Programming - ATMega2560

I am having some trouble uploading code to my Seeeduino ADK (essentially a Arduino Mega 2560) using Eclipse. Basically, this thread explains my problem. Sometimes I get a series of timeouts using the Arduino IDE upload, which is usually fixed by removing and re-inserting the USB. Unfortunately enough, this does not help fix the problem in Eclipse.
I have been trying to do the upload using AVRdude via the command line (I even tried the "hacky" solution in the last comment of the above thread), but to no avail. This is the line I am using for this:
"%AVR_DUDE%" -pm2560 -cstk500v2 -P\\.\%COMM_PORT% -b115200 -F -V -D - Uflash:w:"%HEX_FILE%":a -C"%AVR_DUDE_CONF%"
Which gives me:
avrdude.exe: stk500v2_ReceiveMessage(): timeout
I know the above batch variables are OK, because AVRdude runs correctly (but then it times out). If anyone has any ideas or tips that could help me with my uploading I would greatly appreciate it. Thanks beforehand.
EDIT: As it turns out, the reason for this may be that the Arduino IDE sends a reset to the board before uploading, something which the Eclipse AVR plugin does not do. I will test this and write a uploading perl script, but I am fairly certain this is the problem.
Your suspicion is correct. The Arduino IDE uses a patched version of AVRDude to pulse the DTR line and reset the board before each upload. For some reason, some people have had difficulty getting the right command line parameters to replicate this on the Mega2560. I've had the same problem myself - ATMega328's work with no problem, but the 2560 needs to be reset manually.
There's some further explanation and tips for possibly getting it working here (check the comments too): http://false.ekta.is/2011/05/avrdude-5-10-arduino-mega-2560-command-line-uploading/
Check out the detail here... http://false.ekta.is/2011/05/avrdude-5-10-arduino-mega-2560-command-line-uploading/
If using avrdude > version 5.1 change the programmer to -cwiring
This will reset the chip first