- 
                Notifications
    You must be signed in to change notification settings 
- Fork 12
add Armv5te default start routine #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2a372b0    to
    4cde2e7      
    Compare
  
    | The versatileab machine in QEMU can be booted with an ARM926 processor (in fact, that's the normal processor - booting it with Cortex-R5 instead is a bit weird). So, would you like to expand the versatileab examples to test this target? | 
| } | ||
| ); | ||
|  | ||
| // Start-up code for Armv5TE. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is basically exactly the same as the v7-r start-up code, maybe we should just add arm_architecture="v5te" to that block of code?
| FYI: 
 | 
| So, I looked into this and there are some issues with the ARMv5TE target: 
 | 
| Oh, interesting. I have the following interrupt handler from some C/C++ project //------------------------------------------------------------------------------
/// Handles incoming interrupt requests by branching to the corresponding
/// handler, as defined in the AIC. Supports interrupt nesting.
//------------------------------------------------------------------------------
irqHandler:
/* Save interrupt context on the stack to allow nesting */
	sub     lr, lr, #4
	stmfd   sp!, {lr}
	mrs     lr, SPSR
	stmfd   sp!, {r0, lr}
/* Write in the IVR to support Protect Mode */
	ldr     lr, =AT91C_BASE_AIC
	ldr     r0, [lr, #AIC_IVR]
	str     lr, [lr, #AIC_IVR]
/* Branch to interrupt handler in Supervisor mode */
	msr     CPSR_c, #ARM_MODE_SVC
	stmfd   sp!, {r1-r3, r4, r12, lr}
	blx     r0
        
/* Restore scratch/used registers and LR from User Stack */
/* Disable Interrupt and switch back in IRQ mode */      
	ldmia   sp!, {r1-r3, r4, r12, lr}
	msr     CPSR_c, #ARM_MODE_IRQ | I_BIT
/* Acknowledge interrupt */
	ldr     lr, =AT91C_BASE_AIC
	str     lr, [lr, #AIC_EOICR]
/* Restore interrupt context and branch back to calling code */
	ldmia   sp!, {r0, lr}
	msr     SPSR_cxsf, lr
	ldmia   sp!, {pc}^
some of the handling probably belongs in a C handler, but the context code might be interesting.. | 
| I propose we close this and I'll come back with a fuller PR that resolves the architecture issues with our current assembly code (perhaps #78, or perhaps I'll do it in smaller pieces because that got a bit big) | 
| Yes, this can be closed | 
I tested this with an ARM926EJ-S based board. Have not done much more than an empty main loop though, but that worked.