After a long time of absence due to personal reasons I decided to take up the SRV-1 robot and get busy with the mazebot again. Picking up an old project after some months have passed is quite frustrating as you try to remind yourself of the whole process and trying to remember what’s what. But since I picked it up again I decided to write a sort of guide for compiling the firmware for SRV-1 under Windows and uploading it to the robot. I hope it can come in handy for other SRV-1 users.
First of all let’s start with what you will need. You will have to download:
- The blackfin developer’s toolchain (We need it since the processor is the BF537 blackfin processor)
- The latest official SRV-1 firmware from the google code repository list
- Now, I will assume that you have mingw32 make from the mingw32 package. You will most probably have it in your computer if you have ever downloaded anything GCC-related.If not then you can get it as a standalone package from here.
Now that we have everything we need, let’s add some tools we will need from the blackfin toolchain to our System’s path. You do know what THE PATH is right?
- In any Windows System search for the “My Computer” Icon. (In the Start menu in Windows 7)
- Right click and select “Properties”
- Go to the “Advanced Tab” (Advanced System Settings for Windows 7)
- Right at the bottom there should be a button, “Environment Variables”. Click it.
- In the “System Variables” search for a variable named “Path”. Select it and click Edit.
- Add “;PATH_TO_THE_TOOLCHAIN/elf/bin” (without the ” ” of course).
Where for PATH_TO_THE_TOOLCHAIN you should enter the directory where you installed it.
Remember that when editing the path you need to add a semicolon (;) to separate each different directory. By adding the elf/bin directory of the toolchain to our system’s path we can now directly refer to tools such as bfin-elf-gcc (the gcc compiler for the blackfin processor) which reside in there. In general whenever you ask for something from inside a console command window all of the directories inside the “Path” are searched.
Now I would recommend copying mingw32-make.exe (remember that you should have downloaded it right?) into the “PATH_OF_SRV1FIRMWARE/blackfin/srv/ “, this is where the firmware source code is located. Of course instead of copying it to the same folder you can add the mingw32-make.exe container folder into the System Path following the six steps above. Whatever you choose the end result should be the same.
Now open a console command window.(Press the Start button and choose “Run”. Type “cmd” and press ENTER). Inside there navigate to the directory where the SRV1 firmware is located by using the “cd” command. (I assume you know basic DOS commands ). Having reached the directory of the firmware all you need to do to let the magic begin is to type:
You should now be seeing a screen full of stuff. This is the compiler telling you what it is doing. Unless you wrote the code yourself then this should not matter to you. If all goes well then you should get something like this at the very end :
Adding DXE 'srv1.bin' ... [initcode 208] [jump block to 0x00000000] [ELF blo ck: 32760 @ 0x00000000] [ELF block: 15008 @ 0xFF800000] [ELF block: 7520 @ 0xFF9 00000] [ELF block: 32960 @ 0xFFA00000] OK! Done!
That’s it! You compiled the srv1 firmware under windows! See that .bin file? That’s your firmware.The .ldr file that’s generated from the .bin file is all we care about. As a side note, keep in mind that by issuing a command like: “mingw32-make clean” you effectively clean the project (deleting all the object files and the binary files). In case you want to recompile or if you just want to clean the folder from all those ugly .o files you can use it.
Now to get the freshly compiled firmware into the robot! For windows you can download a nice program called Tera Term to connect to the SRV-1. Assuming you are already connected with the robot open up Tera Term.
Remember to de-select the Telnet option as this will cause you trouble later in the transfer process. Enter “169.254.0.10” as the IP adress and “10001” as the port. Press ‘V’ and see if you get the Version String as a reply just to make sure that we are succesfully connected with the robot. If the connection is succcesfull then press ‘X’ to switch the robot to X-Modem Receive mode. You should be getting a string of CCCC characters now. This denotes that the robot is waiting for the file…
From inside Tera Term choose File–>Transfer–>XModem–>Send and select the “.ldr” file that you created just a while ago when you compiled the firmware. You should be seeing a transfer window that will be showing the transfer’s progress. When the transfer ends you should see something like:
##Xmodem success. Count: XXXX (a number)
Now we are sure that the binary firmware file transferred successfully.
Now to write this to the boot sector of the flash memory let’s issue the command “zZ”. It will take some time to reply but we should get a reply such as:
##zZ boot image write count:XXXX(a number)
Now the new firmware is safely written in the boot sector of the robot’s flash memory. All you have to do is restart the robot either by shorting the appropriate pins or by issuing a “$!” command.
Congratulations! Your have successfully compiled and uploaded firmware to the robot. For any additional questions you can email me at firstname.lastname@example.org.
Have fun playing around with the code! 🙂