Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM GCC

Post Reply
User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM GCC

Post by aBUGSworstnightmare »

Hi,

since I would like to be able to compile/link and debug the Baseflight and Harakiri project on my own, I've started writing an 'How-To'-Guide on 'Compiling/Linking of Baseflight and Harakiri by using the ARM GCC Toolchain with Keil MDK-Lite IDE'.

You can find the guide and the related files here: http://www.rc-heli-fan.org/resources/baseflight-compile-link-howto-tutorial-rev0r2/129715
A ready-to-use Keil+ARM GCC Baseflight Project (Source r468) is available here: http://www.rc-heli-fan.org/resources/ke ... 468/129629

Let me know your thoughts. Happy coding, kind regards
aBUGSworstnightmare

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by timecop »

Great write-up.
I tried to get gcc working under keil with 4.x uVision IDE and it was a mess that never worked correctly.

Looking forward to 'debugging' section - hopefully it "just works", because current state of opensores debuggers is pretty sad.

Also of note, the project moved to github for source control - official source releases are now at https://github.com/multiwii/baseflight

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by aBUGSworstnightmare »

Hi timecop,

glad you like it :D

Well, I think debugging will be easy when using the right tools! I will start the write-up with Segger's J-Link EDU (http://www.segger.com/j-link-edu.html) and J-Link ultra+ (http://www.segger.com/jlink-ultra-plus.html) and will try using Rowley's CrossConnect for ARM (http://www.rowley.co.uk/arm/CrossConnect.htm) and IAR J-Link lite (http://www.iar.com/jlink_lite_cm/) in the second row.

I'm interested to see if IAR J-Link lite will work in this environment (since it can't be used under pure Keil MDK http://www.segger.com/j-link-oem-versions.html).

Rgds
Joerg
aBUGSworstnightmare

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by timecop »

Oh, I'm sure if debugging GCC-built stuff actually works then the end adapter doesn't matter - the underlying protocol should be same. Once i get some free time I'll try this w/gcc and keil ulink2 and jlink.

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by scrat »

timecop wrote:Great write-up.
I tried to get gcc working under keil with 4.x uVision IDE and it was a mess that never worked correctly.

Looking forward to 'debugging' section - hopefully it "just works", because current state of opensores debuggers is pretty sad.

Also of note, the project moved to github for source control - official source releases are now at https://github.com/multiwii/baseflight



This is always the latest DEV version? https://github.com/multiwii/baseflight/tree/master/obj

What about version number?

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by aBUGSworstnightmare »

Well ... seems like debugging will give some serious fun to figure the 'how-to' out!

Made a short test run with my Segger J-Link ultra+. After changing the settings it is possible to flash the device via J-Link (SWD-Interface)

Flashing the device via J-Link (SWD Interface) is working/possible
Flashing the device via J-Link (SWD Interface) is working/possible


But when I attempt to start the debugger it is still using the code size limited version

MDK-Lite Debugger is limited in code size too (32kB)
MDK-Lite Debugger is limited in code size too (32kB)


Debugger error message
Debugger error message


Now I need to figure out how to use a different debugger (GDB) under Keil MDK-Lite :evil: Any advice is welcome!

aBUGSworstnightmare

hinkel
Posts: 109
Joined: Sun Sep 09, 2012 7:24 am

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by hinkel »

scrat wrote:What about version number?

+1
since baseflight beginning it is a pain to find the revision number ! why don't integrate the info in this code line !

Code: Select all

cliPrint("Afro32 CLI version 2.2 " __DATE__ " / " __TIME__);

like this for exemple:

Code: Select all

cliPrint("Afro32 master r4??  CLI ver 2.2" __DATE__ " / " __TIME__);


It is so difficult ?......

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by timecop »

The date is already there.
Why would anyone need more info than that? Also, since we're not using SVN anymore, the 'rxxx' doesn't apply anyways.
And yes, latest BUILT version is at https://github.com/multiwii/baseflight/tree/master/obj.
Source of course could be newer.

rortega
Posts: 34
Joined: Sat Aug 11, 2012 7:34 pm

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by rortega »

timecop wrote:The date is already there.
Why would anyone need more info than that? Also, since we're not using SVN anymore, the 'rxxx' doesn't apply anyways.
And yes, latest BUILT version is at https://github.com/multiwii/baseflight/tree/master/obj.
Source of course could be newer.


Does this mean trat the repository at http://code.google.com/p/afrodevices/source/browse/#svn will not contain any more the latest source code? If I want to have updated baseflight do I must checkout from ginthub at URL
https://github.com/multiwii/baseflight ?

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by timecop »

Yes

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: Compiling/Linking Baseflight and Harakiri - KEIL MDK+ARM

Post by aBUGSworstnightmare »

Hi,

since I still need to figure out how to debug with Keil + GCC I've made a short test with another IDE for giving me a lift.

I've use emIDE (http://emide.org) and my Segger j-Link ultra+.
After the projects was set-up and configured (not a big deal at all; be shure to use the start-up and linker script file supplied with the How-To!) I just made a short debug-session which went flawlessly.

emWin - debugging with J-Link
emWin - debugging with J-Link


Maybe an option if Keil refuses to debug with GDB.

@Timecop: can you pls clarify what you do with/in void ACC_getADC(void)? GCC generates a Compiler Error here for -O3 setting.
GCC compiler segmentation fault error with -O3 optimization
GCC compiler segmentation fault error with -O3 optimization


aBUGSworstnightmare

Post Reply