ChibiOS OpenOCD support

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: ChibiOS OpenOCD support

Post by mabl »

Thx, you are correct. :oops: That makes things easy.
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: ChibiOS OpenOCD support

Post by mabl »

Giovanni, I think the ch_root symbol is automatically removed by the GCC garbage collection.... :cry:
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS OpenOCD support

Post by Giovanni »

Mh, I have to reference it somewhere...

Could you add a "keep" to the linker script in the meanwhile? or just disable the GC in the Makefile.

Giovanni
mabl
Posts: 417
Joined: Tue Dec 21, 2010 10:19 am
Been thanked: 1 time

Re: ChibiOS OpenOCD support

Post by mabl »

Hi Giovanni,

i did so already. Disabling my GC will result in too big executable in my test program. I'm sure you'll find a nice place to reference it.

Best,
MaBl
dandys
Posts: 7
Joined: Sun Aug 05, 2012 1:08 pm

Re: ChibiOS OpenOCD support

Post by dandys »

Hi mabl,

maybe gcc __attribute__ ((used)) can also work for you to preserve structure. But don't know if any other commercial compilers has some similar option, so not sure about portability. Another solution would be put structure in dedicated section and use KEEP keyword for this input section in linker script.
noether
Posts: 91
Joined: Wed Nov 16, 2011 3:18 pm

Re: ChibiOS OpenOCD support

Post by noether »

mabl wrote:Giovanni, I think the ch_root symbol is automatically removed by the GCC garbage collection.... :cry:


From my ignorance in programming but, can not you just declare it as "volatile"? then the compiler will not remove it.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS OpenOCD support

Post by Giovanni »

Hi,

I never used "volatile" in that context but probably you are right, I will give it a try.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS OpenOCD support

Post by Giovanni »

I missed this:

@dandys, I believe that __attribute__ is a GCC-specific extension.

Giovanni
dandys
Posts: 7
Joined: Sun Aug 05, 2012 1:08 pm

Re: ChibiOS OpenOCD support

Post by dandys »

Giovanni wrote:I missed this:
@dandys, I believe that __attribute__ is a GCC-specific extension.

Agree. But there can be some similar extensions for other compilers too (as is for packed structures for example). In this case some macros like KEEP_SYMBOL_BEGIN and KEEP_SYMBOL_END can be defined in chtypes.h. Are some IAR or KEIL users arround? Anyway still not sure if this would be the best solution. Declaring as volatile won't work IMHO. At least I can't find it _must_ work in C89 spec.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS OpenOCD support

Post by Giovanni »

Mhh, then I will just add a reference somewhere to the variable.

thanks,
Giovanni
Post Reply