Pages: [1]   Go Down
Author Topic: Why have cortex_handlers.c?  (Read 1137 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1654
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This file, cortex_handlers.c, implements these dummy interrupt handler.
Code:
void NMI_Handler( void );
void HardFault_Handler( void );
void MemManage_Handler( void );
void BusFault_Handler( void );
void UsageFault_Handler( void );
void SVC_Handler( void );
void DebugMon_Handler( void );
void PendSV_Handler( void );

Currently these handlers don't get loaded, so you can override the weak dummy handler define by the Atmel file.  The Atmel weak handlers are also a forever loop.

Why not continue to let the user override these handlers?
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8589
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Why not continue to let the user override these handlers?
Is that not the case with the Arduino setup?

They are only prototypes aren't they, can't you still define your own functions?

______
Rob
« Last Edit: December 09, 2012, 08:07:51 pm by Graynomad » Logged

Rob Gray aka the GRAYnomad www.robgray.com

0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1654
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

They are not prototypes.  I listed the protoypes but here is a typical handler in this file
Code:
void SVC_Handler( void )
{
  for ( ;; ) ;
}

This file is in the cores/arduino folder and doesn't currently get linked to replace the weak symbols.

I believe the intent is to link these handlers.  I base this on a message from cmaglie.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 129
Posts: 8589
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I see.

So that file is superfluous at present and worse could stop you from defining your own functions if it is ever linked in.

_____
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Forum Administrator
Offline Offline
God Member
*****
Karma: 52
Posts: 646
I find plain exciting
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

can somebody open an issue on github? cristian will get rid of the file in the next release

m
Logged

Forum Administrator
Milano, Italy
Offline Offline
Sr. Member
*****
Karma: 23
Posts: 292
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Uhm, I should have fixed this some times ago:

https://github.com/arduino/Arduino/blob/ide-1.5.x/hardware/arduino/sam/cores/arduino/cortex_handlers.c

there are other places where its left defined?
Logged

C.

Venezuela
Offline Offline
God Member
*****
Karma: 17
Posts: 522
Ground, ground, always ground
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Something to think before get rid of cortex_handler.c and other ARM related files :
 
The Cortex-M3 processor introduces new powerful features (if compare with prior art). This make the Cortex-M3 processor attractive to existing ARM processor users as well as many new Arduino users considering use of 32-bit micro controllers in their products. Let's consider only NMI_Handler, a non maskarable interrupt for safety-critical tasks. NMI_Handler is the highest priority exception other than reset followed by the HardFault_Handler. It is permanently enabled and has a fixed priority of -2. It's already defined in sam3x8e.h and startup_sam3xa.c. I believe, whoever from Atmel or Arduino added this file to the library, surely was thinking in future developments related to NMI.
A practical application? NMI could be connected to a watchdog timer or a voltage-monitoring block and generates panic requests that warns the processor to take actions if the WDT hangs or when the voltage drops below a certain level. Arduino Due could turn on or toggle a LED through sam_gpio.h. I would even go as far as to write an example. In other words, the fact that is not useful now, doesn't mean that we should cut it out of Arduino library. Remember, we are pulling Due from the ARM underworld to Arduino arenas. I am far to be an ARM connoisseur but just a different point of view.
Logged

Forum Administrator
Milano, Italy
Offline Offline
Sr. Member
*****
Karma: 23
Posts: 292
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yup, but we are not talking about removing handlers, but about cleaning-up some handlers that was defined as a non-weak functions that does nothing!  see the example posted by fat16lib:

Code:
void SVC_Handler( void )
{
  for ( ;; ) ;
}

this was due to some testing code coming from the beta-testing period and not cleaned up. But I'm pretty sure I've already fixed upstream.

Logged

C.

Pages: [1]   Go Up
Jump to: