Go to advanced search

by mrvn
Thu Mar 03, 2016 10:43 pm
Forum: Raspbian
Topic: Raspbian Jessie (64bit) for RPi3?
Replies: 145
Views: 132993

Re: Raspbian Jessie (64bit) for RPi3?

It is true that in 64bit mode pointers are bigger so you need more memory and incurr overhead in speed too. But that's why there is also IP32 ABI, where int and pointers are 32bit and longs are 64bit. Pointers get 0 extended on use which you can usualy do for free. You gain all the extra registers a...
by mrvn
Sun Apr 19, 2015 3:19 pm
Forum: Bare metal, Assembly language
Topic: ARM assembly encodings?
Replies: 13
Views: 2062

Re: ARM assembly encodings?

I'm not sure what you are doing but the gdb stubs that you put in your OS should be able to look at the threads mode to figure out if it is running thumb or not. And the gdb side should already know how do decode opcodes.
by mrvn
Sun Apr 19, 2015 11:53 am
Forum: Bare metal, Assembly language
Topic: ARM assembly encodings?
Replies: 13
Views: 2062

Re: ARM assembly encodings?

Just use binutils objdump -d.
by mrvn
Sun Apr 19, 2015 11:49 am
Forum: Bare metal, Assembly language
Topic: DSB instruction and ARMv6
Replies: 3
Views: 2818

Re: DSB instruction and ARMv6

Luckily deprecated only means they will go away in some future version. Not that you can't use them. Using the old style barriers works on both RPi and RPi2. For extra bonus points you could use boot time patching like linux does for SMP and XEN. Define a macro for each barrier type that will insert...
by mrvn
Sun Apr 19, 2015 11:41 am
Forum: Bare metal, Assembly language
Topic: How fast a Raspberry Pi can boot?
Replies: 21
Views: 11358

Re: How fast a Raspberry Pi can boot?

For measuring boot times I used the system timer and it's free running 64bit count register. Could you print that out in your boot test and compare it with the times you measured externally? I wonder if the clock starts automatically on power on or if the VC has to boot up first and configure it. Th...
by mrvn
Sun Apr 19, 2015 11:35 am
Forum: Bare metal, Assembly language
Topic: Task Scheduling with Interrupts
Replies: 5
Views: 2441

Re: Task Scheduling with Interrupts

While that might seem to work it is also completly broken (the C part). See below. I think I've figured out most of my problems and implemented most of your suggestions, jwatte :) Here is what my methods look like now. vector.s ;@ And here is the actual interrupt handler code. arm_interrupt_handler:...
by mrvn
Sun Apr 19, 2015 10:34 am
Forum: Bare metal, Assembly language
Topic: Setting up modes?
Replies: 8
Views: 3966

Re: Setting up modes?

The previous replies went into all the gritty details about what modes are and where in the ARM ARM to read about it. But lets just explain what is going on with a few simple words. Hope that helps future readers. I was wondering about setting up SP in different modes, and in DEN0013D_cortex_a_serie...
by mrvn
Sun Apr 19, 2015 10:06 am
Forum: Bare metal, Assembly language
Topic: RPi2 memory map
Replies: 3
Views: 3120

Re: RPi2 memory map

The bootloader puts ATAGs at 0x100 and passes that address in R2 when it calls your kernel (unless you enabled device tree loading the config.txt). For a simple example for parsing the ATAGs you can look at https://github.com/mrvn/RaspberryPi-baremetal/tree/master/004-a-t-a-and-g-walk-into-a-baremet...
by mrvn
Sun Apr 19, 2015 9:53 am
Forum: Bare metal, Assembly language
Topic: Loading Code Into a Memory Address?
Replies: 3
Views: 1180

Re: Loading Code Into a Memory Address?

The ARM cpu in the RPi also supports setting a exception vector base address in the VBAR register. This avoids the need to copy the exception vector to either its low or high address completly. In C the code looks like this: extern uint32_t exception_vector[]; void set_vbar(uint32_t *base) { asm vol...
by mrvn
Sun Apr 19, 2015 9:32 am
Forum: Bare metal, Assembly language
Topic: Issue with Porting to ARM
Replies: 5
Views: 1237

Re: Issue with Porting to ARM

Hi there, author of Raspbootin here. The Raspbootin is not ment to load an ELF file because that isn't what the Raspberry Pi normaly does. It's ment to load the same flat binary image that you would load directly from SDcard, except load it over serial. So that ELF isn't working is expected behaviou...
by mrvn
Tue Apr 07, 2015 12:25 pm
Forum: Bare metal, Assembly language
Topic: How do I wait 150 cycles (with cache on)?
Replies: 3
Views: 1048

Re: How do I wait 150 cycles (with cache on)?

That would produce a delay between 2-3 microsecond per pin (wait for the counter to change, set clock, wait again, remove clock, wait again). I does work but it is rather a lot larger than 150 cycles, which I want to avoid.
by mrvn
Tue Apr 07, 2015 8:23 am
Forum: Bare metal, Assembly language
Topic: How do I wait 150 cycles (with cache on)?
Replies: 3
Views: 1048

How do I wait 150 cycles (with cache on)?

Changing the pull up/down resistors for GPIO pins on a Raspberry Pi requires waiting for 150 cycles after enabling and disbaling the clock signal according to specs. Doing it a bit longer doesn't hurt but using a timer to wait is longer by magnitudes so I don't want to do that. So I have this simple...
by mrvn
Wed Mar 04, 2015 4:29 pm
Forum: Bare metal, Assembly language
Topic: Does RPi2 honor "kernel_address"?
Replies: 6
Views: 1860

Re: Does RPi2 honor "kernel_address"?

Set both of those and your kernel will be loaded at 0 (or kernel_address if specified). Does that also apply to the extra cores on the RPi2? I assume normaly the bootcode at 0 would halt the extra cores till something is written to their mailboxes. So will they all power up and start executing the ...
by mrvn
Sat Feb 28, 2015 6:11 pm
Forum: Bare metal, Assembly language
Topic: STICKY: Bare Metal resources
Replies: 26
Views: 107355

LEDs (plural) on the Raspberry Pi / Pi2

Raspberry Pi The Raspberry Pi has 5 LEDs on the board: Power, Activity, Full Douplex, Link and 100Mbit. The last 3 I assume are connected directly to the ethernet chip. I'm unsure about the power LED. The activity LED though is connected to GPIO pin 16 and configured for output on boot. One can sim...
by mrvn
Thu Feb 26, 2015 7:41 pm
Forum: Bare metal, Assembly language
Topic: Trying Bare Metal on Raspberry Pi 2
Replies: 98
Views: 33957

Re: Trying Bare Metal on Raspberry Pi 2

If you change the resolution code to: ; Setup Frame Buffer SCREEN_X = 1920 SCREEN_Y = 1080 You will see smooth animation even at this high resolution for the 1st time! What kind of FPS do you get? 60 fps. The source code is available if you want it. I just did a little speed test on a 1920x1200x32 ...
by mrvn
Thu Feb 26, 2015 6:01 pm
Forum: Bare metal, Assembly language
Topic: Trying Bare Metal on Raspberry Pi 2
Replies: 98
Views: 33957

Re: Trying Bare Metal on Raspberry Pi 2

mimi123 wrote:(I'm currently coding a Qemu for Pi2)
Will you put it on github or is it there already?
by mrvn
Thu Feb 26, 2015 9:21 am
Forum: Bare metal, Assembly language
Topic: Trying Bare Metal on Raspberry Pi 2
Replies: 98
Views: 33957

Re: Trying Bare Metal on Raspberry Pi 2

If you change the resolution code to: ; Setup Frame Buffer SCREEN_X = 1920 SCREEN_Y = 1080 You will see smooth animation even at this high resolution for the 1st time! What kind of FPS do you get? My framebuffer access seems really slow, being uncached. But when I turn on caching for the framebuffe...
by mrvn
Thu Feb 26, 2015 9:01 am
Forum: Bare metal, Assembly language
Topic: Interrupts on RPI2 / SMP
Replies: 6
Views: 2155

Interrupts on RPI2 / SMP

Now that everyone has an RPi2 and has the extra cores up and running (you did buy one, right? And saw the SMP demos? :) ) the next step is figuring out the interrupts and inter process communication. So far I figured out that Broadcom tagged on extra interrupts on top of what RPi1 had and there shou...
by mrvn
Wed Feb 25, 2015 11:30 pm
Forum: Bare metal, Assembly language
Topic: Trying Bare Metal on Raspberry Pi 2
Replies: 98
Views: 33957

Re: Trying Bare Metal on Raspberry Pi 2

I now have a nice RPi 2 demo that is almost exclusively C/C++ with all the essentials and some bling: Multi-core Mandelbrot demo Design notes: My boot steps are as follow: setup stack, clear bss, call kernel_main (in boot.S) initialize the activity LED (bootloader should have done that but lets be s...
by mrvn
Mon Feb 23, 2015 8:06 pm
Forum: Bare metal, Assembly language
Topic: Trying Bare Metal on Raspberry Pi 2
Replies: 98
Views: 33957

Solved: MMU problems with multi-core

Ok, verry stupid mistake here. I didn't set any stack for the other cores. So as soon as the code got complex enough to need stack core 2 crashes. I've added a little asm stub to set up a stack and then call the C code now and that works. I've also added int id = get_mpidr() & 3; while(true) { count...
by mrvn
Mon Feb 23, 2015 7:10 pm
Forum: Bare metal, Assembly language
Topic: Trying Bare Metal on Raspberry Pi 2
Replies: 98
Views: 33957

Problem with the MMU in multi-core mode

Thanks for the SMP info. Turns out it is realy easy to start cores. But that brings me to the next problem: MMU/Caches with multi core. I have the MMU and caches all working in single core mode. Here is what I do for SMP: /********************************************************************** * MMU ...
by mrvn
Tue Feb 17, 2015 11:33 pm
Forum: Bare metal, Assembly language
Topic: Trying Bare Metal on Raspberry Pi 2
Replies: 98
Views: 33957

Re: Trying Bare Metal on Raspberry Pi 2

Here is the full working source: format binary as 'img' PERIPHERAL_BASE = $3F000000 ; Raspberry Pi 2 Peripheral Base Address GPBASE = $200000 ; $3F200000 GPFSEL1 = $4 ; $3F200004 GPSET1 = $20 ; $3F200020 GPCLR1 = $2C ; $3F20002C org $8000 mov r0,PERIPHERAL_BASE orr r0,GPBASE ; R0 = GPBASE ldr r1,[r...
by mrvn
Sun Feb 15, 2015 11:11 am
Forum: Bare metal, Assembly language
Topic: Task switching
Replies: 2
Views: 1097

Re: Task switching

You actually need a little bit more and lets cover a bit more of the mechanism as several things work together here. First task switching will normaly happen during an interrupt or syscall, when the task is interrupted and the cpu enters kernel mode. For a purely cooperative multitasking you would h...
by mrvn
Sat Feb 14, 2015 12:30 pm
Forum: Bare metal, Assembly language
Topic: Confused by the Device Tree (shipped with raspian)
Replies: 4
Views: 4721

Re: Confused by the Device Tree (shipped with raspian)

Here is the device tree passed after boot (using bcm2709-rpi-2-b.dtb in config.txt): /dts-v1/; // magic: 0xd00dfeed // totalsize: 0x3f00 (16128) // off_dt_struct: 0x38 // off_dt_strings: 0x154c // off_mem_rsvmap: 0x28 // version: 17 // last_comp_version: 16 // boot_cpuid_phys: 0x0 // size_dt_strings...

Go to advanced search