File tree Expand file tree Collapse file tree 2 files changed +24
-15
lines changed Expand file tree Collapse file tree 2 files changed +24
-15
lines changed Original file line number Diff line number Diff line change 11@ SPDX - License - Identifier: MPL - 1 . 0
22@ Copyright (c) 2016 Tobias Schießl
3- . global ExceptionHandler
3+ . global ExceptionHandlerStart
4+ . global ExceptionHandlerEnd
45 . global IRQHandler
56 . global SWIHandler
67
2021
2122 .code 32
2223
24+ @ XXX this code will be copied ( in one chunk) to the 0xffff0000 internal RAM ,
25+ @ but the assembler/linker * do not know this * . Access to things outside of this file
26+ @ (such as the reset via calling Entry) needs to be written in a position - independent way.
27+
2328@ Default entry for all vectors except Reset is "B ExceptionHandler" so each interrupt would cause a reset
2429@ Since I can only say th at the IRQ Handler works , we leave the remaining ones as they are
25- ExceptionHandler :
26- B Entry
27- B ExceptionHandler
30+ ExceptionHandlerStart :
31+ ldr pc , = Entry
32+ B ExceptionHandlerStart
2833 B SWIHandler
29- B ExceptionHandler
30- B ExceptionHandler
31- B ExceptionHandler
34+ B ExceptionHandlerStart
35+ B ExceptionHandlerStart
36+ B ExceptionHandlerStart
3237 B IRQHandler
33- NOP @ Fall to FIQHandler
38+ B FIQHandler
39+
40+ .pool
3441
3542FIQHandler:
3643 STMFD r13 ! , {r0 - r7 , lr}
@@ -104,4 +111,7 @@ loop:
104111@
105112@ End of the file
106113@
114+
115+ .pool
116+ ExceptionHandlerEnd:
107117 .end
Original file line number Diff line number Diff line change @@ -394,16 +394,15 @@ const pbdrv_ioport_platform_data_t pbdrv_ioport_platform_data[PBDRV_CONFIG_IOPOR
394394};
395395
396396// See exceptionhandler.S
397- extern void ExceptionHandler (void );
397+ extern void ExceptionHandlerStart (void );
398+ extern void ExceptionHandlerEnd (void );
398399
399400void copy_vector_table (void ) {
400- unsigned int * dest = (unsigned int * )0xFFFF0000 ;
401- unsigned int * addrExceptionHandler = (unsigned int * ) ExceptionHandler ;
402- int i = 1 ;
401+ void * dest = (void * )0xFFFF0000 ;
402+ void * addrExceptionHandler = (void * ) ExceptionHandlerStart ;
403+ uint32_t sz = ( uint32_t ) ExceptionHandlerEnd - ( uint32_t ) ExceptionHandlerStart ;
403404
404- for (; i < 8 + 2048 ; ++ i ) {
405- dest [i ] = addrExceptionHandler [i ];
406- }
405+ memcpy (dest , addrExceptionHandler , sz );
407406}
408407
409408unsigned int EDMAVersionGet (void ) {
You can’t perform that action at this time.
0 commit comments