Porting ChibiOS to Microsemi SF2

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
IgorEE
Posts: 21
Joined: Fri Nov 14, 2014 4:40 pm

Porting ChibiOS to Microsemi SF2

Post by IgorEE »

Hi,

I recently started playing with the Micorsemi SmartFusion2 SoC using an AVnet SmartFusion2 KickStart kit. SmartFusion2 (SF2) is "vanilla" ARM Cortex M3 processor, with very few peripherals (2xUART, 2xSPI, 2xI2C, USB, ETHERNET, RTC...) but coupled to an FPGA array. Microsemi's FPGA fabric is a bit special as it is flash based (opposed to SRAM based offerings from market leaders Xilinx and Altera) and perhpas more importantly it is SEU (Single Event Upset) immune. This comes as an important selling point / attribute in Aerospace / Medical / Process critical applications.

Microsemi offers it's Libero software for designing the system for the SF2 and this takes care of generating the FPGA fabric configuration for custom logic or provided IP cores. Microsemi also offers SoftConsole for then writing firmware for the CM3. SoftConsole is similar to ChibiStudio as it is Eclipse/GCC based. Once a project is finished in Libero, a firmware is exported and then imported into SoftConsole. The exported firmware is a CMSIS folder and device drivers (if provided IP Cores are used). The user can then write the required application software in this SoftConsole (Eclipse) environment building on top of the rudimentary peripheral drivers exported from Libero.

I would like to use the exported CMSIS files (which presumably contain the startup files for the SF2 CM3 core, and all the memory / register mappings) and perhaps the provided peripheral driver files, to then port ChibiOS to this architecture. Being essentially a vanilla CM3 core, I guess this should be possible, but as it is early days for me with both SF2 and somewhat with ChibiOS (especially since the re-organisation to version 16) I'd like to evaluate how ambitious this would be.

Hence, could please let me know, is there a guide for making ports in addition to the "Porting ChibiOS for dummies" guide? More importantly, when making a port as described, what files/folders do I actually need to modify and which parts of the OS can I just "copy over"? Basically, i'd like a ballpark idea how much needs to be modified/written and what are these files that need to be modified/written? As a starting point, I expect all the HAL _lld files need to be re-written, but this is for HAL not RT.

I realize the question is quite vague, but any feedback is appreciated so that I can try to decide whether this is something within my abilities/knowledge and available time to do.

Thanks for reading!
Regards,
-Igor
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Porting ChibiOS to Microsemi SF2

Post by Giovanni »

Hi,

Basically it is just an ARM CM3 device. ChibiOS just requires:

1) CMSIS device headers, you have those.
2) A chparams.h header, see the existing ones, it is very simple to do: \os\common\ports\ARMCMx\devices
3) Creating .ld and .mk files, look under \os\common\ports\ARMCMx\compilers\GCC

You don't need special startup files or vectors table, use the ChibiOS ones.

This is sufficient for porting the RTOS. See the RT-ARMCM4-GENERIC demo and use it as template for your test application, it does not use HAL, just RT.

Giovanni
utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Has thanked: 1 time
Been thanked: 20 times

Re: Porting ChibiOS to Microsemi SF2

Post by utzig »

I don't have any guide written down, and also don't have a lot of experience in porting but I created two ARM based ports which are published (Kinetis/nRF51). My pull request for adding the nRF51 support to ChibiOS-Contrib might be something interesting to check:

https://github.com/ChibiOS/ChibiOS-Contrib/pull/7

If you look at the individual commits (from top to bottom) you'll have an idea of the order of things and maybe the reasoning for doing them.

If I get some free time on my vacation (which starts in two weeks) I might try to write something down about those experiences in a "how to" format.

Cheers,
Fabio Utzig
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Porting ChibiOS to Microsemi SF2

Post by Giovanni »

utzig wrote:If I get some free time on my vacation (which starts in two weeks) I might try to write something down about those experiences in a "how to" format.


If you want I could make an account for you to edit the home wiki, you could add articles there, the syntax is very easy. There are already some "how to"s there.

Giovanni
utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Has thanked: 1 time
Been thanked: 20 times

Re: Porting ChibiOS to Microsemi SF2

Post by utzig »

I guess I already have access to the wiki, unless it was disabled or the system changed. Will check tonight.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Porting ChibiOS to Microsemi SF2

Post by Giovanni »

utzig wrote:I guess I already have access to the wiki, unless it was disabled or the system changed. Will check tonight.


That was the old one, you still have access there, I am referring to the homepage.

Giovanni
utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Has thanked: 1 time
Been thanked: 20 times

Re: Porting ChibiOS to Microsemi SF2

Post by utzig »

Ok, looks good. Feel free to send the data to my email. Use my usual username, please!
IgorEE
Posts: 21
Joined: Fri Nov 14, 2014 4:40 pm

Re: Porting ChibiOS to Microsemi SF2

Post by IgorEE »

Hi Giovanni and Fabio,

Thank you for your feedback. I will start looking into those files and whether I can get ChibiOS ported to SF2 as soon as time permits. I'm a hardware designer / electronics engineer so my knowledge of embedded programming is not stellar, but I'd like to give it a shot.

Fabio: If you get around to posting your experiences with porting ChibiOS that would be appreciated.

Thanks guys,
-Igor
Post Reply