Page 2 of 18

Re: ChibiOS OpenOCD support

Posted: Sun Aug 26, 2012 7:45 pm
by mabl
Thx, you are correct. :oops: That makes things easy.

Re: ChibiOS OpenOCD support

Posted: Sun Aug 26, 2012 8:21 pm
by mabl
Giovanni, I think the ch_root symbol is automatically removed by the GCC garbage collection.... :cry:

Re: ChibiOS OpenOCD support

Posted: Sun Aug 26, 2012 8:49 pm
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

Re: ChibiOS OpenOCD support

Posted: Sun Aug 26, 2012 8:54 pm
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

Re: ChibiOS OpenOCD support

Posted: Mon Aug 27, 2012 6:25 am
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.

Re: ChibiOS OpenOCD support

Posted: Mon Aug 27, 2012 7:16 am
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.

Re: ChibiOS OpenOCD support

Posted: Mon Aug 27, 2012 8:12 am
by Giovanni
Hi,

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

Giovanni

Re: ChibiOS OpenOCD support

Posted: Mon Aug 27, 2012 12:20 pm
by Giovanni
I missed this:

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

Giovanni

Re: ChibiOS OpenOCD support

Posted: Mon Aug 27, 2012 12:51 pm
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.

Re: ChibiOS OpenOCD support

Posted: Mon Aug 27, 2012 1:18 pm
by Giovanni
Mhh, then I will just add a reference somewhere to the variable.

thanks,
Giovanni