Good news! We managed DirectC to program the Sysboot of SmartFusion and now it is working! xD. Now it goes automatically to fix a position in the memory at start-up where we can load the user program.
Tomorrow (actually today) we will complete the rest of the libraries, sensors and motors mainly.
It was tricky but now we can do it. We have now a program that downloads an image to write on the FPGA fabric.
Initially the approach was to write using the UART to download the image but it seemed that this could take more time to develop than intended initially so the approach was changed to another were we compress the image and store in the MSS RAM.
One problem with this approach is that the compressed image might be bigger than the amount of memory that the MSS RAM can hold, so this may require segmentation of the FPGA image (it is still not yet verified if the image can be bigger than that). Another problem is that the binary that programs the image in the FPGA has to be relinked to the image, which needs to be loaded to the MSS again. This problem can be overcame by downloading the image to the MSS RAM, without relinking it to the application that flashes it to the SPI flash, then writing the image to the SPI flash memory.
Another problem to deal with is that this was tested only on the SmartFusion eval board, and the eval board uses a flash memory that is different from that of the Tutobot. Since that SPI flash has a compatible instruction set, we expect that it will work with having to fix it.
Updates of the project:
- SmartFusion A2F200 and OpenOCD
After preparing the patch to OpenOCD to support writing in the flash memory, we sent the patch. It was refused due the amount of code from Actel we used to generate the embedded bin program. We could provide a cleaner code, removing the unused things from Actel’s driver, but it is working and we don’t have much time, after Rose we can work more in the patch.
If you are still interested in this patch you can found it here. Or send us an email .
Our PCB has arrived! \o/ Seems that we are going to weld the components tomorrow
- Libero (FPGA and project configuration)
The routing of FPGA is done, a map between MSS ans FPGA, which are the things that can be connected directly with a GPIO and which can not. So after we have our robot, we will be able to drive the peripherals which doesn’t need a complex FPGA support.
Necessary HDL modules will be done together with the peripheral’s drive.
We integrated FreeRTOS to our project. There is just some minor things we need to configure, as the code work in the Ram but doesn’t in Rom memory =/
SPI driver is done and tested for SmartFusion Evaluation Board, we will need to adjust some aspects of the drive to our SPI flash memory
After the OpenoCD patch, we tested DirectC in flash it is working but it is not fully integrated with the project. Tomorrow we hope to have the FPGA programing environment working and tested with our Robot.
More updates tomorrow.
Today Gabriel started to work in the code to write in the SPI flash memory. Thalita and I continue working in OpenOCD to support writting in the NVM flash memory of SmartFusion.
We organized our presentation for tomorrow too.
Some diagrams to help understand the project :
Hardware diagram :
Flashing the FPGA Fabric diagram :
More updates tomorrow.
I spent the weekend until now to compile the DirectC for Smartfusion. In the beginning I thought I could compile it to be executed from the RAM, but the binary was too big for the RAM (the RAM can hold 64kb, but the binary was 76kb big). Thus I had to compile it for the Flash and relying that we will be able to flash it using openocd (and also that this will work). In parallel to this, the stdlib also had to be compiled with the DirectC, since it depends on many functions of the stdlib, like memset. In the beginning, the code was compiled with the option -nostdlib, which was fine while we didn’t have to use stdlib. Now we needed that, thus I removed the option, which would try to link crt0.o instead of the startup code provided by Actel (which we where using since the beginning). The solution was to add the -nostdlib option again and link explicitly the stdlib. Now it compiles ok.
Saturday our PCB was completed, some screen shots :
Gabriel is working in the DirectC, a set of code to implement In-application programming (IAP) for the Cortex and FPGA. The main goal is to program the FPGA from an image.dat file generated by Libero IDE as we won’t be using a FlashPro chip and we are not sure if the FlashPro software can be used without it.
We also studied how to work with Libero, route pins of FPGA and generate an image.dat file. The program is not complicated and the Libero Project of Tutobot should be ready soon.
Now Thalita and I, we are working in a patch to OpenOCD to be able to write in the flash memory of SmartFusion by OpenOCD. The idea is loading a code in RAM which writes on the Flash as we didn’t find any documentation about driving the Flash memory directly through JTAG.
More updates tomorrow.