Online Lectures….. Interactive Training Seminar…

In these hard times, we are all looking for some solutions to reach people with the same interests. So we have the intention to do our first webinar/lecture online!! We are excited! It will be all about “Getting started with Nuttx” with STM!

I also made a VirtualBox image for the participants. I am still learning Nuttx myself, but you learn the most when you teach right?

https://us04web.zoom.us/j/361350421?pwd=RGlhUkcxOG5XOUhDYVdINks5eFVrZz09

https://www.dropbox.com/sh/n51ficlngwpn6l7/AADaqVA-B0bICxNZp1ZskQXLa?dl=0

Maybe I will see you there? I have never used this platform before and it can handle 100 participants. So I hope all goes well. I have tested it with a few people.

Enjoy!

“Be careful…. Stay fit, stay healthy! If not for yourself, do it for someone else!”

Custom PCB+Nuttx+STM32L432KC

Maybe you all thought we were gone, but this was not the case. When 2020 started the prospects were looking good, but we all had to cope with Corona…. In the meantime, we wrote the book further, made some investments so try to support online support and had to do some great projects with Nuttx.

And the transition from BSD to Apache is still going on, but I think there are some clever people working on that. Till then we still use the bitbucket distro from Nuttx (BSD).

We have to build a PCB with relays, CAN, TCP-IP, etc… where we are still working on the TCP-IP stack. We are reaching the resource limits of the STM32L432KC 😉 It is a really nice small form factor device!

My tasks.json in Visual Studio Code with STM32 and Nuttx

Maybe it helps some of you out when I share my “Build Tasks” [CTRL+Shift+B]

{
     // See https://go.microsoft.com/fwlink/?LinkId=733558
     // for the documentation about the tasks.json format
     "version": "2.0.0",
     "tasks": [
         {
             "label": "build Nuttx project",
             "type": "shell",
             "command": "sudo make apps_clean && sudo make",
             "group": {
                 "kind": "build",
                 "isDefault": true
             }
         },
         {
             "label": "clean Nuttx project",
             "type": "shell",
             "command": "sudo make clean",
             "group": {
                 "kind": "build",
                 "isDefault": true
             }
         },
         {
             "label": "flash upper STM32F411",
             "type": "shell",
             "command": "sudo openocd -f interface/stlink.cfg -f target/stm32f4x.cfg -c \"hla_serial 066CFF575450707267222722\" -c \"program nuttx.bin 0x08000000 verify exit\"",
             "group": {
                 "kind": "build",
                 "isDefault": true
             }
         },
         {
             "label": "flash lower STM32F411",
             "type": "shell",
             "command": "sudo openocd -f interface/stlink.cfg -f target/stm32f4x.cfg -c \"hla_serial 0673FF575450707267203957\" -c \"program nuttx.bin 0x08000000 verify exit\"",
             "group": {
                 "kind": "build",
                 "isDefault": true
             }
         }
     ]
 }

One could also use this for Openocd:

sudo openocd -f interface/stlink.cfg -f target/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x08000000"

Debugging Nuttx on STM32 with Visual Studio Code

After using Eclipse for some time, I have come to a state where Visual Studio Code is more appealing. And why? Because Eclipse messed up my repo once again. And I want to try something out with Visual Studio Code.

I like the interface and also its speed. The extensions are getting more available and even when you want to code with ARM/GNU.
I have made a screenshot of the plugins I am using.

My workflow is simple but effective. And I cannot wait that Nuttx has its Apache repo up and running. So now, the examples are still based on Nuttx 8.2.

For debugging, I use the Cortex-Debug extension. Simple, but fast and has some excellent features, and I use ST MCU most of the time, and then you can also load its SVD (=System View Description) file. You can find those at https://www.st.com/en/microcontrollers-microprocessors/stm32-high-performance-mcus.html

To get it all working, you have to make a “Debug Config.” Just click on the “turtle icon with a cross” and create a *.json file.

I will give an example of an OpenOCD file which works for me:

{
     // Use IntelliSense to learn about possible attributes.
     // Hover to view descriptions of existing attributes.
     // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
     "version": "0.2.0",
     "configurations": [
         {
             "cwd": "${workspaceFolder}",
             "executable": "${workspaceFolder}/nuttx",
             "name": "Debug Microcontroller",
             "request": "launch",
             "type": "cortex-debug",
             "servertype": "openocd",
             "interface": "swd",
             "svdFile": "/home/ds/Documents/SVD_Files_STM32/en.stm32f4_svd/STM32F4_svd_V1.2/STM32F407.svd",
             "configFiles": [
                 "interface/stlink.cfg",
                 "target/stm32f4x.cfg"
             ],
             "preRestartCommands": [
                 "file nuttx",
                 "load",
                 "add-symbol-file nuttx 0x8000000",
                 "enable breakpoint",
                 "monitor reset"
             ],
             "showDevDebugOutput": true
        }
 }

Now you can run your “debugger” by choosing the Debug Config file in the selection menu on the top left in your IDE. Next to the button, “Debug and Run.” And then, you will spot a config with the name: “Debug Microcontroller.”

You will get features like below: Peripherals, Registers, Watch, etc…
Happy debugging!!!

And have a great 2020!!!!!!!!

Flash multiple boards with OpenOcd (in Console or use it in Jenkins)

Do you also have the problem when you are using multiple boards and you want your app (or kernel) from Nuttx flashed to different boards? Well, you can achieve this by calling your device with “hla_serial” on its ID!

You could use these commands in your IDE as a task, or implement them in your CI environment.

=== Flashing different STM32 at once
lsusb -v #for finding your device ID
sudo openocd -f interface/stlink.cfg -f target/stm32f4x.cfg -c "hla_serial " -c "program nuttx.bin 0x08000000 verify exit"

Thanks, Paul Fertser for the tip!