AnsweredAssumed Answered

iMx25 harware register

Question asked by Simon Legrand on Jun 1, 2016
Latest reply on Jun 14, 2016 by Simon Legrand

I'm running bare metal on iMx25 PDK with debug board.
I'm trying to access UART register (USR1) on user mode but each time it raise a data abort.
Is hardware register only accessible from privileged mode ?


Documentation says I can read/write as user, may be I miss to configure a register but i don't know which one.


This is the exemple code I made to read USR1 at the boot.



// After a reset, the mode is ARM, Supervisor, interrupts disabled.

// Invalidate both ICache and DCache : not done upon emulator reset

    ldr         r1,=0

    mcr         p15,0,r1,c7,c7,0

// Disable MMU translation, D cache and enable I cache

    mrc         p15,0,r1,c1,c0,0

    ldr         r0,=CP_DIS_MASK         // 0xFFFFEFFA

    and         r1,r1,r0

    orr         r1,r1,#(1<<12)

    orr         r1,r1,#2

    mcr         p15,0,r1,c1,c0,0


// Initialize clocks

bl    low_level_init

// Switch to user and try access USR1

    bic     r0,r0,#MODE_MSK                     // Clear the mode bits

    orr     r0,r0,#USR_MODE                     // Set USER mode bits

    msr     cpsr_c,r0

    ldr     r3, =0x43f90098

    ldr        r3,[r3]


If you have any idea why I can't access uart register in user mode, any help is welcome.

Thanks in advance.