public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Possible bug regarding NVIC init in Cortexm arch HAL
@ 2011-03-08 17:58 Daniel Helgason
  0 siblings, 0 replies; only message in thread
From: Daniel Helgason @ 2011-03-08 17:58 UTC (permalink / raw)
  To: ecos-discuss

Hello,

I think I spotted a possible bug in hal_misc.c file in the Cortexm arch
HAL.

On line 234 there is a snippet of code that loops, initializing both
hal_interrupt_handlers[] and the NVIC. The loop counts from 1 to
CYGNUM_HAL_ISR_COUNT. It looks something like this:

for( i = 1; i < CYGNUM_HAL_ISR_COUNT; i++ )
{
   hal_interrupt_handlers[i] = (CYG_ADDRESS)hal_default_isr;
   *** program NVIC priority for this interrupt; ***
}

This is not a problem for the existing Cortex platforms but it will be a
problem for platforms that springboard to additional interrupts that are
not controlled by the NVIC. They will have CYGNUM_INTERRUPT_xxx and
CYGNUM_HAL_ISR_COUNT that are greater than the number of interrupts
directly controlled by the NVIC (CYGNUM_HAL_INTERRUPT_NVIC_MAX).

I think the loop needs to be changed to two loops, one that sets
hal_interrupt_handlers table and one that sets NVIC priorities.
Something like this:

for( i = 1; i < CYGNUM_HAL_ISR_COUNT; i++ )
   hal_interrupt_handlers[i] = (CYG_ADDRESS)hal_default_isr;

for( i = 1; i <= CYGNUM_HAL_INTERRUPT_NVIC_MAX; i++ )
   *** program NVIC priority for this interrupt; ***

-- 
+------------------------------------
| Daniel Helgason <dhelgason@shaw.ca>



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-08  2:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08 17:58 [ECOS] Possible bug regarding NVIC init in Cortexm arch HAL Daniel Helgason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).