Optimization issue in RISC-V BSP

Joel Sherrill joel at rtems.org
Fri Jul 28 14:18:57 UTC 2017

On Fri, Jul 28, 2017 at 8:19 AM, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> On 28/07/17 15:15, Denis Obrezkov wrote:
> 2017-07-28 14:56 GMT+02:00 Joel Sherrill <joel at rtems.org <mailto:
>> joel at rtems.org>>:
>>     There is a debug option near the bottom of confdefs.h which you
>>     can enable to generate a data structure filled in with various
>>     values computed by confdefs. You can look at that in gdb without
>>     loading it on the target.
>>     It is probably worth it to look at that now and see what you spot.
>> Okay, I'll try.
>>     And a random thought.. what's the interrupt stack size and how is
>>     it allocated? What are the port specific related macros set to?
>> I don't completely understand what is the interrupt stack. Because, when
>> an interrupt occurs,
>> I save all registers and move the stack pointer, handle interrupt,
> Now you handle the interrupt on the stack of the interrupted context
> (usually a thread). So, you must take this overhead into account for every
> thread. If you switch to an interrupt stack, then you only have to account
> for one interrupt frame per thread. If you support nested interrupts, you
> need even more space per thread without an interrupt stack.

There are at least these settings plus the default interrupt stack size
which can be
defined for each port:

/sparc64/rtems/score/cpu.h:#define CPU_HAS_SOFTWARE_INTERRUPT_STACK   TRUE
./sparc64/rtems/score/cpu.h:#define CPU_HAS_HARDWARE_INTERRUPT_STACK  FALSE
./sparc64/rtems/score/cpu.h:#define CPU_ALLOCATE_INTERRUPT_STACK      TRUE

Based on how you have the interrupt support configured, the last one trips
code in score/src/isr.c to allocate memory for a dedicated interrupt stack.

But the confdefs.h debug trick should quickly give you some insight. Look
CONFIGURE_CONFDEFS_DEBUG in confdefs.h to see what it turns on
for helping you debug.


> restore registers and move stack
>> pointer back.
>> --
>> Regards, Denis Obrezkov
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
> --
> Sebastian Huber, embedded brains GmbH
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170728/40c20ad3/attachment-0002.html>

More information about the devel mailing list