MPC5748G: MachineCheck exception hen trying to access peripherals in user mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5748G: MachineCheck exception hen trying to access peripherals in user mode

256 Views
Nox-rr
Contributor I

Hello,

I ported OpenPicoRTOS to PowerPC platforms & ran into an issue.

Despite configuring the PBRIDGE (correctly ?) i get a MachineCheck exception every time i try to access a peripheral in user mode.

Supervisor mode works fine but it's not really what i'm after, i want user/supervisor mode management (+MPU) & being able to access peripherals in user mode.

I tried various things but nothing seems to work, i don't know if i'm doing something wrong of it it's simply not possible.

Right now i just kept everything in supervisor mode for demonstration purposes, here's the current state of the code:

 - My attempt at configuring the PBRIDGE:

https://github.com/jnaulet/OpenPicoRTOS/blob/v1.11.x/arch/powerpc/e200z4/mach-mpc574x/startup.S

 - The de-activated user mode (in arch_save_first_context):

https://github.com/jnaulet/OpenPicoRTOS/blob/v1.11.x/arch/powerpc/e200z4/picoRTOS_portasm.S

 - The complete demo i use for debugging this system:

https://github.com/jnaulet/OpenPicoRTOS/tree/v1.11.x/demo/devkit-mpc5748g

Any help is appreciated.

Kind regards.

0 Kudos
Reply
1 Reply

125 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

there can be multiple reasons for user mode access rejection:

Most probably PBRIDGE or MPU configuration.

You can start checking following:

  1. PBRIDGE PACR/OPACR initialization.
  2. Whether all peripheral slots are configured for user access.
  3. MPU region definitions covering:
    • 0xFxxxxxxx peripheral space
    • read/write permissions
    • supervisor/user attributes.
  4. MSR value after the RTOS drops to user mode.
  5. The exact peripheral address that causes the fault.
  6. MCSR/ESR/DEAR at IVOR1 entry.

Best Regards,

Peter

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2387351%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMPC5748G%3A%20MachineCheck%20exception%20hen%20trying%20to%20access%20peripherals%20in%20user%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2387351%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI%20ported%20OpenPicoRTOS%20to%20PowerPC%20platforms%20%26amp%3B%20ran%20into%20an%20issue.%3C%2FP%3E%3CP%3EDespite%20configuring%20the%20PBRIDGE%20(correctly%20%3F)%20i%20get%20a%20MachineCheck%20exception%20every%20time%20i%20try%20to%20access%20a%20peripheral%20in%20user%20mode.%3C%2FP%3E%3CP%3ESupervisor%20mode%20works%20fine%20but%20it's%20not%20really%20what%20i'm%20after%2C%20i%20want%20user%2Fsupervisor%20mode%20management%20(%2BMPU)%20%26amp%3B%20being%20able%20to%20access%20peripherals%20in%20user%20mode.%3C%2FP%3E%3CP%3EI%20tried%20various%20things%20but%20nothing%20seems%20to%20work%2C%20i%20don't%20know%20if%20i'm%20doing%20something%20wrong%20of%20it%20it's%20simply%20not%20possible.%3C%2FP%3E%3CP%3ERight%20now%20i%20just%20kept%20everything%20in%20supervisor%20mode%20for%20demonstration%20purposes%2C%20here's%20the%20current%20state%20of%20the%20code%3A%3C%2FP%3E%3CP%3E%26nbsp%3B-%20My%20attempt%20at%20configuring%20the%20PBRIDGE%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjnaulet%2FOpenPicoRTOS%2Fblob%2Fv1.11.x%2Farch%2Fpowerpc%2Fe200z4%2Fmach-mpc574x%2Fstartup.S%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fjnaulet%2FOpenPicoRTOS%2Fblob%2Fv1.11.x%2Farch%2Fpowerpc%2Fe200z4%2Fmach-mpc574x%2Fstartup.S%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B-%20The%20de-activated%20user%20mode%20(in%20arch_save_first_context)%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjnaulet%2FOpenPicoRTOS%2Fblob%2Fv1.11.x%2Farch%2Fpowerpc%2Fe200z4%2FpicoRTOS_portasm.S%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fjnaulet%2FOpenPicoRTOS%2Fblob%2Fv1.11.x%2Farch%2Fpowerpc%2Fe200z4%2FpicoRTOS_portasm.S%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B-%20The%20complete%20demo%20i%20use%20for%20debugging%20this%20system%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fjnaulet%2FOpenPicoRTOS%2Ftree%2Fv1.11.x%2Fdemo%2Fdevkit-mpc5748g%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fjnaulet%2FOpenPicoRTOS%2Ftree%2Fv1.11.x%2Fdemo%2Fdevkit-mpc5748g%3C%2FA%3E%3C%2FP%3E%3CP%3EAny%20help%20is%20appreciated.%3C%2FP%3E%3CP%3EKind%20regards.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2388099%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20MPC5748G%3A%20MachineCheck%20exception%20hen%20trying%20to%20access%20peripherals%20in%20user%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2388099%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%0A%3CP%3Ethere%20can%20be%20multiple%20reasons%20for%20user%20mode%20access%20rejection%3A%3C%2FP%3E%0A%3CP%3EMost%20probably%20PBRIDGE%20or%20MPU%20configuration.%3C%2FP%3E%0A%3CP%3EYou%20can%20start%20checking%20following%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EPBRIDGE%20PACR%2FOPACR%20initialization.%3C%2FLI%3E%0A%3CLI%3EWhether%20all%20peripheral%20slots%20are%20configured%20for%20user%20access.%3C%2FLI%3E%0A%3CLI%3EMPU%20region%20definitions%20covering%3A%0A%3CUL%3E%0A%3CLI%3E0xFxxxxxxx%20peripheral%20space%3C%2FLI%3E%0A%3CLI%3Eread%2Fwrite%20permissions%3C%2FLI%3E%0A%3CLI%3Esupervisor%2Fuser%20attributes.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EMSR%20value%20after%20the%20RTOS%20drops%20to%20user%20mode.%3C%2FLI%3E%0A%3CLI%3EThe%20exact%20peripheral%20address%20that%20causes%20the%20fault.%3C%2FLI%3E%0A%3CLI%3EMCSR%2FESR%2FDEAR%20at%20IVOR1%20entry.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EBest%20Regards%2C%3C%2FP%3E%0A%3CP%3EPeter%3C%2FP%3E%3C%2FLINGO-BODY%3E