KICS! brainstorming

Joel Sherrill joel.sherrill at oarcorp.com
Tue Jul 22 18:37:15 UTC 2014


On 7/22/2014 1:05 PM, Daniel Gutson wrote:
> Hi,
>
>    we are working in a very RAM constrained board, and noticed that
> some symbols could be moved to ROM by declaring them const.
Have you been through the configure options like switching scheduler,
lowering
stack sizes, etc.?
> I have a slight idea about creating a consts-candidate detector tool
> "KICS!" (Keep It Const, St.! :) ), and wanted to hear some other
> people ideas.
>
> Initial thoughts:
>   - one approach could be a gdb script, in which we first read all the
> RAM memory of global objects after initialization (#1), and compare
> the memory at the end (#2), see what remained unchanged; this could
> throw many false positives but would be a starting point.
This could give you a quick list of candidates. Then.. below.
>   - another, I think tougher, is some pointer-tracking static analysis
> as a gcc plugin (not sure if it is even possible).
Likely very difficult.
> Other ideas?
Make them const and see if they end up on the right hand side of an
assignment?

When you think you have a candidate, ask on the list if it can be const.
Include a patch, especially if it involves more than changing the const
declaration. Given a candidate, I would expect the developers to have
a pretty quick assessment.

Also in some places, we have gone to a single data structure with
fields which might otherwise be global variables.  This only puts
one symbol in the public name space. It is possible that in some
cases, there may be data items mixed which could be const with
those which can't.

--joel
>
>
> (#1) after bsp_start? after rtems_initialize_data_structures?
>
> (#2) for some user-definition of "end", and/or after
> rtems_shutdown_executive or alike?
>
> Thanks!
>
>    Daniel.
>

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the devel mailing list