Keil gcc compatible version of crazyflie_firmware

Firmware/software/electronics/mechanics
wwfiney
Beginner
Posts: 21
Joined: Sat Nov 30, 2013 1:58 am
Location: Shanghai, China

Keil gcc compatible version of crazyflie_firmware

Post by wwfiney »

Hi,
I have made a version of crazyflie firmware support both keil and gcc compile environment.
If you are interested in it, get it from
https://github.com/wwfiney/crazyflie_firmware_keil_gcc

I use my own board(not crazyflie nano quadcopter), and it can work under Keil uVision4.
The porting version is based on the original version of cf_firmware, so it should work.

If any bug contact me
wwfiney@hotmail.com
-----------------------------------------------------------------------------------------------------------------------
2013.12.14
commit 7aa4f06c551ad9a1969158d98781d765ac0fb6e7
Fix address bug in log/param module
Last edited by wwfiney on Sat Dec 14, 2013 4:02 am, edited 5 times in total.
DerShu
Beginner
Posts: 23
Joined: Thu Nov 14, 2013 3:01 pm
Location: Bavaria - Germany

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by DerShu »

wwfiney wrote:Hi,
I have made a version of crazyflie firmware support both keil and gcc compile environment.
If you are interested in it, get it from
https://github.com/wwfiney/crazyflie_firmware_keil_gcc
WOW!!!! Thank you very much!

I just tried it locally here and saw that a Keil build produces 40 warnings. I just made a cursory investigation into some of the warnings and it looks like many are related to the structure of FreeRTOS tasks like "statement is unreachable", and others are also not likely to produce any problems. I did see some warnings related to mixing of types that are apparently not causing problems currently. I am a retired hardware engineer, so software is not my strong point, but do you think that it would be worthwhile to work through the Keil warnings to get rid of the warnings?
wwfiney
Beginner
Posts: 21
Joined: Sat Nov 30, 2013 1:58 am
Location: Shanghai, China

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by wwfiney »

Hi DerShu:
Thanks for your suggestion. Yes, I will fix all the warning if possible.
The first version should be functional OK. Most of the warning can be suppressed and I did some in the linker command line settings.
I am a software engineer, and not strong at HW.
If you are interested in quadcopter, maybe we can help each other, lol.
DerShu
Beginner
Posts: 23
Joined: Thu Nov 14, 2013 3:01 pm
Location: Bavaria - Germany

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by DerShu »

wwfiney wrote:Hi DerShu:
Thanks for your suggestion. Yes, I will fix all the warning if possible.
The first version should be functional OK. Most of the warning can be suppressed and I did some in the linker command line settings.
I am a software engineer, and not strong at HW.
If you are interested in quadcopter, maybe we can help each other, lol.
You do not need to fix the warnings just for me! I was just wondering if I should try clearing the warnings? As far as I can tell none of them should cause any problems for now. I just got my Crazyflie, so I will be able to test a Keil build as soon as I get a chance to get it going. When you set up compile and link options in uVision, did you configure it to build an executable that could be loaded via the Crazy Radio bootloader, or will your configuration need JTAG to load?
As far as hardware help I would be glad to do what I can, but I think this forum is going to be a great place for all of us to help each other. I have an idea for evolving my CrazyFlie eventually into larger QuadRotor with ESCs and outrunner motors. I was thinking of combining it with either a Maple or an Olimexino STM32 board to handle motor control and some other possible functions? This looks like it will be a fun way to spend some of my retirement. :D
wwfiney
Beginner
Posts: 21
Joined: Sat Nov 30, 2013 1:58 am
Location: Shanghai, China

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by wwfiney »

Now, the warning seems OK for the main function.
But I don't have crazyflie HW, so I can't tested it.
The linker options make it run at 0x08000000 (like make CLOAD=0), this means it can't support CLoader.
Next step, I will make it support cloader. Maybe just change scatter loader file.
wwfiney
Beginner
Posts: 21
Joined: Sat Nov 30, 2013 1:58 am
Location: Shanghai, China

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by wwfiney »

I have worked through all warning, and suppress them.
Don't worry, I checked these warnings, it should be OK.
And I found an issue in eskylink.c
function "eskylinkDecode"

Code: Select all

static CRTPPacket crtpPacket;
  float pitch, roll, yaw;
  uint16_t thrust;
  
  pitch = ((packet[2]<<8) | packet[3])-PPM_ZERO;
  if (roll<(-PPM_RANGE)) roll = -PPM_RANGE;
  if (roll>PPM_RANGE) roll = PPM_RANGE;
  pitch *= 20.0/PPM_RANGE;

Code: Select all

  if (roll<(-PPM_RANGE)) roll = -PPM_RANGE;
  if (roll>PPM_RANGE) roll = PPM_RANGE;
may changed to

Code: Select all

  if (pitch<(-PPM_RANGE)) pitch = -PPM_RANGE;
  if (pitch>PPM_RANGE) pitch = PPM_RANGE;
So, this is the only warning still exist.
I have reported this issue to bitcraze, waiting for the response.
DerShu
Beginner
Posts: 23
Joined: Thu Nov 14, 2013 3:01 pm
Location: Bavaria - Germany

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by DerShu »

wwfiney wrote: Next step, I will make it support cloader. Maybe just change scatter loader file.
That may not be quit enough for the Crazyflie bootloader. The scatter file would produce the right load location, but the Crazyflie bootloader uses a binary image file, and the Keil setup is currently producing a regular ARM axf file and a hex file. Is there an output option to produce a simple binary image as well?
wwfiney
Beginner
Posts: 21
Joined: Sat Nov 30, 2013 1:58 am
Location: Shanghai, China

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by wwfiney »

That's easy.
Actually, you can use ARM tools "fromelf" to convert a .axf file to .bin.
Now I have updated the script for this convert. Please get the latest project code.
But please note:
You should modify the fromelf tools path according to your install path.
The setting is in "Options for Target 'Target1'"->User->"Run User
Programs After Build/Rebuild"
DerShu
Beginner
Posts: 23
Joined: Thu Nov 14, 2013 3:01 pm
Location: Bavaria - Germany

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by DerShu »

wwfiney wrote:That's easy.
Actually, you can use ARM tools "fromelf" to convert a .axf file to .bin.
Now I have updated the script for this convert. Please get the latest project code.
But please note:
You should modify the fromelf tools path according to your install path.
The setting is in "Options for Target 'Target1'"->User->"Run User
Programs After Build/Rebuild"
YOU DA MAN !!!!! :D

Dang, I had forgotten all about the fromelf utility. In my defense, it has been a few years since I retired. :oops:
Your IDE setting change did produce the keil.bin file just fine.
I need to get the PS3 flight controller working on my laptop and I will soon be able to test the code! ;)
wwfiney
Beginner
Posts: 21
Joined: Sat Nov 30, 2013 1:58 am
Location: Shanghai, China

Re: I made a keil gcc compatible version of crazyflie_firmwa

Post by wwfiney »

Good luck!
Just remember, now the bin is started from 0x08000000.
Later, I will release a version for CLoader.
Post Reply