Hi All,
I am placing this topic up for discussion and collaboration on the ChibiOS port of APM. The project will be hosted @ https://github.com/bugobliterator/ardupilot-chibios , followed with PR to master repo . The major benefit I am expecting out of this port is smaller footprint and ease of moving across broad range of ARM devices specifically STM32Fxx series. I am currently taking STM32F412 Nucleo board as a reference platform. I see future ports to be done for wide variety of stm32fxx ranging from revo mini boards to Pixhawk 2!
Please feel free to share views on this post and if anyone wants to collaborate, fork the repository mentioned above and make PRs to it.
Recent Update: a maiden flight with Ardupilot running over ChibiOS on Pixhawk 2.1 Cube and all the sensors that are in it were active and had the same configuration as in Nuttx platform.
There are some ways to go to complete the full port, but this is a big milestone and progress until this has validated a lot of potential that comes with us using ChibiOS as a platform for APM.
Special thanks to Tridge for helping to make this port a success!!
I thought I’d mention some of the scheduling results we’re getting with ChibiOS.
Testing on a PH2.1 cube with 3 IMUs (two running at 8kHz), two baros and two compasses, we get:
that shows a scheduling accuracy worst case deviation of just over 300usec, with zero scheduling misses. Given it is doing 7k SPI transactions per second that is remarkable.
the total cpu load shown by SYS_STATUS.load is about 20%.
For comparison, on the current px4-v3 PX4/NuttX build with the same board, we get this:
and a SYS_STATUS.load of around 38%. The worst case scheduling deviation is over 1500usec, so 5x worse than with ChibiOS and nearly double the average CPU load. This is despite us having put a lot of effort into improving the NuttX results over the past year.
@RobertWZ build procedure for current repo is via waf. so you would do ./waf configure --board pixhawk-cube and then ./waf --target bin/arducopter and so on. Since this is under heavy development, build breaking and change in board name could happen.
@olliw42 I decided to go with chibios because of its peripheral HAL layer which makes it easy to port APM without writing much code for hardware peripherals. Its lightweight nature and portability among famous ARM controllers made it a good choice as well. Also my own existing familiarity with chibios also played a role to this choice. We were only to move forward with ChibiOS if it trumps existing RTOS on majority of the counts. So far it looks like it, but we will know more as we spend more time with it.
Autoconfiguration : enabled
Setting board to : pixhawk-cube
Checking for program ‘arm-none-eabi-ar’ : /opt/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-ar
Using toolchain : arm-none-eabi
Checking for ‘g++’ (C++ compiler) : /usr/lib/ccache/arm-none-eabi-g++
Checking for ‘gcc’ (C compiler) : /usr/lib/ccache/arm-none-eabi-gcc
Checking for program ‘make’ : /usr/bin/make
Checking for program ‘arm-none-eabi-objcopy’ : /opt/gcc-arm-none-eabi-4_9-2015q3/bin/arm-none-eabi-objcopy
Checking for program ‘st-flash’ : not found
Could not find the program [‘st-flash’]
For applications that put a heavy load on the autopilot, this will be life altering. For example, if you’re running a mavlink gimbal, logging the gimbal status, ADS-B, co-computer, GCS, etc all at once, it really loads it up. On my Solo with all of that stuff, it’s 2500/10000 max 8000. Horrid. I think ChibiOS will make a big difference in those applications.
one point confuses me:
With the latest master would it still be possible to compile for “Nuttx”, for which all features are available, or is master ChibiOS-only now and one would have to wait if a feature is missing?
If it still can be compiled for Nuttx, what would I have to change to my compile procedure (I’m using the make-based px4 toolchain on Win), or does using make with the parameters as before will do what it did before?
(I would think there would be new parameters for compiling for chibios, so that nothing changes, but some statements I read confused me, hence my questions)
The procedures for building with Nuttx are unchanged and still work. And that’s what people should still use unless they want to be test pilots for ChibiOS.
Make based builds are no longer even used or supported in ArduPilot. WAF is has been the build system of choice for quite some time. So if you’re using something really old with make, it does not and never will build ChibiOS anyway.