Hi All
I am porting a small OS to the nRF52832. I want to be able to lock down memory of unpriviledged processes.
I have not integrated the softdevice yet.
The memory for a process is locked in 5 regions:
- Process Code
- Process RW Data
- OS Code
- OS read-only data
- OS read/write data (mainly SEGGER-RTT)
I get a memory fault (trace output below) on program memory data access - execution does not generate a fault. As seen below, the data access is within the process code region.
If I double the size field of the OS code region, so it includes the process code, everything works. Both regions have the same configuration.
It is not a general problem with setting the size field correctly - if I from "testprocess" try to access first memory location of "test2" process I get a memory fault as expected.
Anyone with a hint or an idea?
TRACE OUTPUT:
J-Link V6.10d - Real time terminal output
J-Link OB-SAM3U128-V2-NordicSemi compiled Sep 26 2016 11:30:32 V1.0, SN=682230412
Process: IarIdePm.exe
[INFO]test2:
code@ 0x00002560 size = 0x00000100, log2( size ) = 8
[INFO] data@ 0x20000700 size = 0x00000100, log2( size ) = 8
[INFO]testprocess:
code@ 0x000021E0 size = 0x00000200, log2( size ) = 9
[INFO] data@ 0x20000600 size = 0x00000100, log2( size ) = 8
[INFO]bsp_os:
code@ 0x00000040 size = 0x00002000, log2( size ) = 13
[INFO] ro data@ 0x20000400 size = 0x00000200, log2( size ) = 9
[INFO] rw data@ 0x20000000 size = 0x00000400, log2( size ) = 10
[FAULT]MEMORY MANAGER FAULT!
[FAULT]CFSR=0x00000082
[FAULT] Data access violation
[FAULT] Data@: 0x00002604
[FAULT] Code@: 0x000025B8
[FAULT]R0=0x00000000
[FAULT]R1=0x0000FA01
[FAULT]R2=0x00000000
[FAULT]R3=0x00000010
[FAULT]R12=0x3D202920
[FAULT]LR=0x00000303
[FAULT]PSR=0x61000000
[FAULT]0: RASR=0x0608000F start=0x00002560 end=0x0000265F Priv ro Unpriv ro
[FAULT]1: RASR=0x1308000F start=0x20000700 end=0x200007FF Full access XN
[FAULT]2: RASR=0x06080019 start=0x00000040 end=0x0000203F Priv ro Unpriv ro
[FAULT]3: RASR=0x12080011 start=0x20000400 end=0x200005FF Priv r/w Unpriv ro XN
[FAULT]4: RASR=0x13080013 start=0x20000000 end=0x200003FF Full access XN
[FAULT]5: RASR=0x00000000 start=0x00000000 end=0x00000001 No access
[FAULT]6: RASR=0x00000000 start=0x00000000 end=0x00000001 No access
[FAULT]7: RASR=0x00000000 start=0x00000000 end=0x00000001 No access