This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] AM3358:裸机中的虚拟寻址

Guru**** 2604225 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/652100/am3358-virtual-addressing-in-bare-metal

器件型号:AM3358

大家好、

我刚刚在 Beaglebone-black armv7中试验了 MMU。

目标:使用其虚拟地址访问 led。

在裸机程序中、我能够打开和关闭 LED。 现在,一旦打开 MMU,我就无法使用其虚拟地址将其打开。

注意:(我将所有代码直接放入 SRAM 并从 SRAM 中执行)

我在代码中具有以下映射:

equ CM_PER_GPIO1_CLKCTRL、0x44e000AC
.equ GPIO1_OE、0x4804C134
.equ GPIO1_SETDATAOUT、0x4804C194
.equ GPIO1_CLEARDATAOUT、0x4804C190
.equ GPIO_V、 0x0804C194

.equ tlb_L1_base、0x40200000

enable_paging:
LDR r0、=tlb_L1_base
MCR P15、0、r0、C2、 C0、0
/*
LDR r0、=0x48001008
LDR R1、=0x48000c02
str R1、[r0]
*/
LDR R4、=0x00100000
LDR R2、=0x40010c02
LDR R3、=1000

.loop_MMU:

STR R2、[r0]、#4/*0th 0x40000000、因此对于80索引0x48000000 */
添加 R2、R2、R4 /*GPIO 应位于0x080*/
subs R3、#1
bne .loop_MMU

mov r0、#0x3
MCR P15、0、r0、C3、 C0、0

MRC P15、0、r0、C1、 C0、0
Orr r0、r0、#0x1
MCR P15、0、 r0、c1、c0、0

mov PC、lr

v_switch_led_on:
ldr r0、=GPIO1_V /*尝试打开 led*/
ldr R2、[r0]
ORR R2、R2、#0x200000
str R2、[r0]
mov PC、LR 

我希望它能正常工作、因为 Pte 看起来不错。 您能帮您找出问题吗?