Can I install the developer VM image natively?

Firmware/software/electronics
Post Reply
salocinx
Beginner
Posts: 21
Joined: Wed Feb 06, 2019 7:58 pm
Contact:

Can I install the developer VM image natively?

Post by salocinx »

Hi

I just received my ST-LINK/V2 device and would like to make progress with my ESP32 deck project. As suggested by the online resources, I checked out the development VM together with VirtualBox on my Windows PC. But it seems, that I have issues with the USB ports, PC-Client doesn't recognize my CrazyRadio PA dongle and the ST-LINK/V2 debugger doesn't to be recognized as well; since the flash targets in Eclipse don't work. Then I read something about going native would be the better choice.

So I would like to install a native Xubuntu/Ubuntu Crazyaflie development system. What's the best way to achieve a similar development environment like the Bitrcraze VM provides. Is there any way to "install" the VM image on a realy Xubuntu/Ubuntu machine somehow? Are there detailed installation/requirements somewhere online in case I need to install Eclipse/ST-LINK/V2/GDB/etc. manually myself? Any help is highly appreciated!

Thank you & cheers,
Nicolas
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Can I install the developer VM image natively?

Post by tobias »

You could start trying to setup the environment on windows. There is a guide here, might be a bit outdated, but a good start.
salocinx
Beginner
Posts: 21
Joined: Wed Feb 06, 2019 7:58 pm
Contact:

Re: Can I install the developer VM image natively?

Post by salocinx »

Hi Tobias.

Thanks for your quick reply. I meanwhile found a way to configure the USB devices so that they are accessible from within the VM. Now it seems to work, at least I can use the "flash using debugger" make target in Eclipse and the firmware gets flashed to the CF2 through the ST-LINK/V2 automatically - wonderful :-) ! Next I will try a debug session, crossing fingers it will work.

Here's what I had to do in order to access the USB devices within the Xubuntu VM provided by Bitcraze (ST-LINK/V2 and CrazyRadio PA USB Dongle):

1.) Installing VirtualBox Extension Pack (to enable USB2 and USB3 support, by default VirtualBox only supports USB1)
-> VirtualBox -> Preferences -> Extensions -> "Add" (https://download.virtualbox.org/virtualbox/ => use same version as your VirtualBox version)

2.) Start the Xubuntu Bitcraze VM and open a Linux terminal and type (username of VM is "bitcraze" and password is "crazyflie" if needed):

Code: Select all

$ sudo gpasswd -a bitcraze vboxsf
3.) Check if bitcraze user is added to the group by typing:

Code: Select all

$ groups bitcraze
4.) Shutdown the Bitcraze VM and go to "Settings -> USB" of your VM instance and click "USB 2.0 (EHCI) Controller" or better "USB 3.0 (xHCI) Controller" if your PC supports USB 3.0

5.) Next, within the same window, add "USB Device Filters". Make sure your ST-LINK/V2 and CrazyRadio PA dongles are plugged-in to your PC:
-> Add "STMicroelectronics STM32 STLink [0100]
-> Add "Bitcraze Crazyradio PA USB Dongle [0053]

6.) Now power-on the Xubuntu Bitcraze VM again and open a Linux terminal and type the following to list all active USB devices connected to your PC:

Code: Select all

$ lsusb
Finally run Eclipse IDE and start the make target "flashing using debugger" to validate everything is working fine. Don't forget to connect the ST-LINK/V2 via USB and a turned-on CF2 via the Bitcraze debug adapter to ST-LINK/V2 using the JTAG flat cable.
salocinx
Beginner
Posts: 21
Joined: Wed Feb 06, 2019 7:58 pm
Contact:

Re: Can I install the developer VM image natively?

Post by salocinx »

I followed the instructions in the wiki here, but unfortunately I get the following error when trying to start a debug session in Eclipse CDT:

Code: Select all

Error in services launch sequence
Launching command [/opt/gnuarmeclipse/openocd/0.9.0-201505190955/bin/openocd -c gdb_port 3333 -c telnet_port 4444 -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg -c init -c targets -c echo "Started by GNU ARM Eclipse"] failed.
Launching command [/opt/gnuarmeclipse/openocd/0.9.0-201505190955/bin/openocd -c gdb_port 3333 -c telnet_port 4444 -f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg -c init -c targets -c echo "Started by GNU ARM Eclipse"] failed.
Cannot run program "/opt/gnuarmeclipse/openocd/0.9.0-201505190955/bin/openocd": Unknown reason
Any idea what I am doing wrong?
salocinx
Beginner
Posts: 21
Joined: Wed Feb 06, 2019 7:58 pm
Contact:

Re: Can I install the developer VM image natively?

Post by salocinx »

I meanwhile managed to install Xubuntu 18.04 LTS + Eclipse CDT + GNU Toolchain + ST-Link/v2 debugging environment.

Here's a short description of the resources that I used to achieve a working installation:

1.) I installed the Bitcraze VM on my Windows PC with Oracle Virtualbox (in order to copy some files to my native Xubuntu machine)

2.) Download and install Xubuntu 18.04 LTS and install to your new PC (use same computer name, user name and password as the Bitcraze VM does: machine-name = "ubuntu"; user-name="bitcraze"; password="crazyflie")

3.) Follow pages 1+2 of this link (I didn't do page 3+4)

4.) Copy the following file from the Bitcraze VM to your new Xubuntu PC (preferably to same folder): /home/bitcraze/bin/update_all_projects.sh

5.) Now you can check out the projects you want from Github to the local folder: /home/bitcraze/projects

6.) Start Eclipse CDT IDE and configure your project as seen on these screenshots
MadeInPierre
Beginner
Posts: 7
Joined: Thu Sep 05, 2019 2:24 pm

Re: Can I install the developer VM image natively?

Post by MadeInPierre »

salocinx wrote: Thu Sep 12, 2019 7:28 pm I followed the instructions in the wiki here, but unfortunately I get the following error when trying to start a debug session in Eclipse CDT:
...
Hi,

I just received a JTAG adapter from the bitcraze shop and STLink V2 debugger with hope to have step-by-step debugging.

I also managed to flash the crazyflie through the debugger just like you (both through the VM as well as my own VS Code in my host Ubuntu), but can't figure out how to get to reach a breakpoint and do step-by-step exploration with the Eclipse configuration in the VM...

I noticed that opening OpenOCD from the Debug configuration in Eclipse doesn't work, so I disabled it and I am running 'make openocd' from the 'crazyflie-firmware' project in a separate terminal and OpenOCD connects successfully to the Crazyflie. But when I launch the Debug in Eclipse, Eclipse seems to stay idle and openocd outputs this:

Code: Select all

bitcraze@ubuntu:~/projects/crazyflie-firmware$ make openocd
openocd -d2 -f interface/stlink-v2.cfg  -f target/stm32f4x_stlink.cfg -c init -c targets -c "\$_TARGETNAME configure -rtos auto"
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
WARNING: target/stm32f4x_stlink.cfg is deprecated, please switch to target/stm32f4x.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v27 API v2 SWIM v6 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.949340
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32f4x.cpu       hla_target little stm32f4x.cpu       running
Info : accepting 'gdb' connection on tcp/3333
Info : device id = 0x10076413
Info : flash size = 1024kbytes
undefined debug reason 7 - target needs reset
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
adapter speed: 1800 kHz
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080002bc msp: 0x20005000
Info : Auto-detected RTOS: FreeRTOS
Error: Error allocating memory for -1515870811 threads
Error: Error allocating memory for -1515870811 threads
===== arm v7m registers
(0) r0 (/32): 0x00000000
(1) r1 (/32): 0x00000000
(2) r2 (/32): 0x00000000
... (it lists all the CF's registers and then stays idle)
Notice that GDB is successfully connected to the OpenOCD terminal but then I get this error line:
Error : Error allocating mamory for -1515870811 threads
Did you manage to make that part work? If so, could you please explain how you did it? And if not, does this information help you to find something new to try maybe?
tobias wrote: Tue Sep 10, 2019 7:12 am There is a guide here, might be a bit outdated, but a good start.
Thank you for the link, but there is a TODO line where there is supposed to be an explanation for making the step-by-step work. Do you know what I'm missing maybe?

Thank you!
Post Reply