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: Virtual addressing in bare-metal

Part Number: AM3358

Hello All,

I was just experimenting with mmu in beaglebone-black armv7.

Goal: To access an led with its virtual address.

In my bare-metal program i was able to switch on and off the led. Now once i turn on the mmu , i am unable switch it on using its virtual address.

note:(i am putting all the code directly into sram and executing it from there)

I have down the following mapping in code:

.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 so for 80th index for 0x48000000*/
	add r2, r2, r4   /*GPIO should be at 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 /*trying to switch on the led*/
	ldr r2, [r0]
        orr r2, r2, #0x200000
	str r2, [r0]
	mov pc,lr

I was hoping it to work, as the pte looks fine. Could you please help in figuring out the problem ?