GT RoboCup SSL
Soccer software, robot firmware
|
The mTrain on boot runs the user program located at the predetermined memory address 0x0800000 We flash code to this address using the J-Link in-order to be executed.
The J-Link software can be downloaded at: https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack For Ubuntu you want to download the file labeled as 'J-Link Software and Documentation pack for Linux, DEB installer, 64-bit'
Provided that file was stored in your downloads folder you can use the below to install the package:
NOTE The name of the exact file may be slightly different depending on what version you downloaded so copying and pasting the above may not work.
After installing the J-Link software package please restart your terminal emulator and try to tab complete and open the program JLinkExe. If you are successful you will be greeted by the following:
Followed by a can not connect error if the J-Link is not connected. Close JLinkExe with exit.
Plug in the JLink unit to a usb port on your computer Attach the ARM-JTAG-20-10 connector to the 20 pin connector side of the J-Link unit.
Attach the smaller 10 pin connector to the 10 pins on the top of the mTrain.
Plug in the mTrain mini usb connector and plug the other end to your computer. TODO attach picture here of JLink header and where it connects on the mTrain
The mini usb powers the mTrain if its not receiving power from the board so it should light up after this.
If you have not already setup robocup-firmware to build do that now (following the guide in getting started). To build it again run the following:
After building navigate to the top level of the robojackets firmware repo. Then navigate to the build location of the robocup binaries:
Run J-LinkExe
At this point you will get the same message as in the setting up J-Link software section. Then you need to connect to the processor via the following command
continue hitting enter to use all the default options and you should get a wall of processor information and a message that you have connected.
To program the mtrain use:
You should now see a progress bar for erasing flash and subsequently flashing memory. After this completes your are done and can exit J-Link. Restart the mTrain with the push button on top of the module and your code should now be running.
Using GDB for debugging with RoboCup Firmware is different than debugging a program on your computer. Normally when start up an instance of GDB, you either start it with a binary name or use file after starting along with a file path to a binary to debug. If a binary is compiled with debug symbols (eg using the -g flag on gcc) the binary will have a symbol table which stores the human readable symbol names for memory locations (variables). Of course in addition to loading the symbol table if it exist gdb also loads the program into your memory and then waits for your to issue run before executing any instructions.
All of the above assumes we are running the program on the same computer we are running gdb. With RoboCup firmware this is not the case. Our program is being executed by the mTrain so we want to debug the code as it runs on the mTrain, not our local system. To do this we setup a gdbserver on the J-Link itself, which will preform the functions gdb did on our local system for the program running on the mtrain (eg starting and stopping the program as it encounters certain memory addresses like breakpoints). However the binary (.bin) we flash to the robot does not contain debug symbols, only the .elf does. The gdb server running on the J-Link does not have any idea what the symbol table contains, just at what memory addresses to stop. Instead we boot a local instance of gdb with the symbol table by loading the .elf and then connect to the gdb server running on the J-Link to control GDB (issue breakpoints, print a variable's value, etc).
Usually we would use run to reload the program but when using GDB server the process is slightly different(note we didnt use run to start the program either). Instead we issue the following two commands to restart the program from the beginning: