Go to advanced search

by romell
Fri Oct 05, 2012 7:47 pm
Forum: Bare metal, Assembly language
Topic: Framebuffer access with ARM MMU enabled
Replies: 1
Views: 1399

Re: Framebuffer access with ARM MMU enabled

First try with all zeroes. That worked fine for me. If that doesn't work then there must be some other problem.
by romell
Tue Sep 04, 2012 9:37 pm
Forum: Bare metal, Assembly language
Topic: Baking Pi
Replies: 168
Views: 29319

Re: Baking Pi

tufty wrote:The downside, obviously, is that you lose 32k, and have to write a little loop to shove your vector table into place.
Well, you don't have to move it. It can be placed anyware. Just set the base address with:

Code: Select all

.global set_vector_base
set_vector_base:
	MCR p15, 0, r0, c12, c0, 0
	bx lr
by romell
Fri Aug 10, 2012 8:32 pm
Forum: Bare metal, Assembly language
Topic: GPIO Input
Replies: 13
Views: 7187

Re: GPIO Input

Well, I have no idea how it's done in Linux. You are in the bare metal forum now, here we don't concern ourselves with that kind of high level stuff :) But I can tell you that there is support in the hardware for detecting rising or falling edges on any of the GPIO pins. If enabled, the event is sto...
by romell
Fri Aug 10, 2012 6:17 pm
Forum: HATs and other add-ons
Topic: Gertboard and Arduino IDE
Replies: 4
Views: 2346

Re: Gertboard and Arduino IDE

I would suggest not using the Arduino IDE at all, and program the device in pure c, using gcc for AVR and upload it to the device with AVRDUDE.

This way you would also learn a lot more about embedded systems development and not have to rely on the Arduino abstraction layer.
by romell
Fri Aug 10, 2012 1:59 pm
Forum: C/C++
Topic: Output binary via GPIO
Replies: 4
Views: 3632

Re: Output binary via GPIO

I haven't used the wiringPi library myself, but it seems that what you want to do should be pretty easy. Define a function that takes a 8-bit number as input and sets the appropriate outputs: void set_pins(uint8_t num) { int i; for (i=0; i<=7; i++) { digitalWrite(i, num & (1<<i) ? HIGH : LOW); } } T...
by romell
Fri Aug 10, 2012 12:43 am
Forum: Bare metal, Assembly language
Topic: Programming in Basic on Bare Metal Tutorial 3
Replies: 33
Views: 7265

Re: Programming in Basic on Bare Metal Tutorial 3

You could of course do most of it in c, which is what everyone but DexOS does. So no, you don't have to learn any assembly if you don't want to.

Take a look at this: http://www.raspberrypi.org/phpBB3/viewt ... 72&t=10850 thread if you want to try some bare metal programming in c. :)
by romell
Thu Aug 09, 2012 11:29 am
Forum: Bare metal, Assembly language
Topic: print char to screen
Replies: 10
Views: 2862

Re: print char to screen

Do you have anything running in bare metal at the moment? Otherwise I suggest that you first look at this: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=72&t=10850 thread to get you started. Then you need to set up a framebuffer according to the specs here: https://github.com/raspberrypi/firmwar...
by romell
Tue Aug 07, 2012 9:18 pm
Forum: Bare metal, Assembly language
Topic: FB doublebuffering
Replies: 27
Views: 5130

Re: FB doublebuffering

...do a barrier = flush caches... Are you sure about this part? The thing that confuses me the most is that there are a lot of slightly different instructions and I'm not really sure with to use where and why... There are at least 4 different (but similar) instructions dealing with this stuff: * In...
by romell
Tue Aug 07, 2012 8:03 pm
Forum: Bare metal, Assembly language
Topic: FB doublebuffering
Replies: 27
Views: 5130

Re: FB doublebuffering

In a very generic sense you put barriers between things that shouldn't be overwitten by crashing code and things that have a potential to overwrite code when crashing. But I suspect this might not be as helpful as I want it to be. Hm, I'm pretty sure that wasn't the kind of barrier he asked about.....
by romell
Tue Aug 07, 2012 3:37 pm
Forum: Advanced users
Topic: RPi as an Unattended Downloading Machine
Replies: 3
Views: 1830

Re: RPi as an Unattended Downloading Machine

As dom said, use for example rTorrent in a Screen session and you can ditch X entirely.

EDIT: Other types of download like ftp or http can be done in the same way with for example wget or your favourite ftp client.
by romell
Mon Aug 06, 2012 10:13 pm
Forum: Bare metal, Assembly language
Topic: FB doublebuffering
Replies: 27
Views: 5130

Re: FB doublebuffering

DexOS wrote: ...its no fun re-coding once a month.
Not if you have to do it in assembly.

"Bazinga" :D
by romell
Mon Aug 06, 2012 8:53 pm
Forum: Bare metal, Assembly language
Topic: FB doublebuffering
Replies: 27
Views: 5130

Re: FB doublebuffering

1) The buffer containing the tag to transfer to the Mailbox wasn't aligned to 16 bytes. (I used an automatic variable instead of a fixed address like I did for the framebuffer init structure) You don't need a fixed address to get the correct alignment. Assuming you're using gcc, just put "__attribu...
by romell
Mon Aug 06, 2012 6:53 pm
Forum: Bare metal, Assembly language
Topic: FB doublebuffering
Replies: 27
Views: 5130

Re: FB doublebuffering

I got it working by sending a message to the mailbox using a message to channel 8 (the one I described above ) , but dex was talking about a different way by writing inside the framebuffer struct and I'm intetested about it . My method works , but doesn't seem like the most efficient I think it's p...
by romell
Mon Aug 06, 2012 12:59 pm
Forum: Bare metal, Assembly language
Topic: [Guide] Beginning Bare Metal on Raspi
Replies: 36
Views: 28493

Re: [Guide] Beginning Bare Metal on Raspi

... ... I accomplish this by not using global variables. i thing global variables have nothing to do in a "kernel". think of putting your kernel into a flash. there you also cant use global variables, because its read only ;-) I absolutely agree and I normally don't use them. That's probably why I ...
by romell
Mon Aug 06, 2012 9:22 am
Forum: Bare metal, Assembly language
Topic: [Guide] Beginning Bare Metal on Raspi
Replies: 36
Views: 28493

Re: [Guide] Beginning Bare Metal on Raspi

tufty wrote: The compiler's doing what it should. Initialising BSS to 0 is one of the first things you should be doing on boot.
Yes, I know. I'm not saying the compiler is wrong, just that when explicitly initializing it in the code, I don't expect it to end up in BSS in the first place...
by romell
Mon Aug 06, 2012 12:13 am
Forum: Bare metal, Assembly language
Topic: [Guide] Beginning Bare Metal on Raspi
Replies: 36
Views: 28493

Re: [Guide] Beginning Bare Metal on Raspi

Wow, I just found a really strange compiler behavior that I thought might be good to share with anyone starting out in bare metal... I have a global variable that I initialize to 0, e.g. uint32_t count = 0; The thing is, when I tested it, the value was always random. So i thought there might be some...
by romell
Sat Aug 04, 2012 2:44 pm
Forum: Bare metal, Assembly language
Topic: Bare Metal VideoCore
Replies: 27
Views: 11899

Re: Bare Metal VideoCore

Hi there, This seems like a fun and pretty ambitious project, but I'm still a bit sceptical for a couple of reasons: * First of all, the last thing we want is for Broadcom to get cold feet and stop putting out firmware updates. The closed source nature of the firmware isn't really as bad as I though...
by romell
Fri Aug 03, 2012 11:42 pm
Forum: Bare metal, Assembly language
Topic: Virtual memory and linking
Replies: 21
Views: 6541

Re: Virtual memory and linking

It works! :D My kernel is now running in the upper parts of virtual memory. I'm currently using a 3:1 split between user and kernel space, but I will probably change that to 1:1 since there seems to be a nice hardware support for that kind of split (see section 6.12.1 of the ARM TRM). The linker scr...
by romell
Fri Aug 03, 2012 10:47 pm
Forum: Bare metal, Assembly language
Topic: [Guide] Beginning Bare Metal on Raspi
Replies: 36
Views: 28493

Re: [Guide] Beginning Bare Metal on Raspi

Cycl0ne wrote:just create a file calles: "dontdeletethis" and bin will be in your repo ;)
Or you could do a .gitignore with just:

Code: Select all

*
!.gitignore
It looks a little bit better and has the added benefit of making git ignore anything else in that folder :)
by romell
Tue Jul 31, 2012 8:51 pm
Forum: Bare metal, Assembly language
Topic: Virtual memory and linking
Replies: 21
Views: 6541

Re: Virtual memory and linking

Thank you Velko, that was exactly what I was looking for! I will try it out tomorrow. Too many beers for any decent coding now I'm afraid. :)
by romell
Tue Jul 31, 2012 5:08 pm
Forum: Bare metal, Assembly language
Topic: Virtual memory and linking
Replies: 21
Views: 6541

Re: Virtual memory and linking

Thanks for the link, I will check it out. Maybe I was a bit unclear about the placement of the kernel. I don't it placed at virtual address 0x8000 and it doesn't really matter where its placed in physical memory as long as I can boot into it and set up an initial page table (identity mapping). My pr...
by romell
Tue Jul 31, 2012 2:04 pm
Forum: Bare metal, Assembly language
Topic: Virtual memory and linking
Replies: 21
Views: 6541

Virtual memory and linking

Hi, I have some, mostly theoretical issues when setting up my virtual memory system. What I want is a single binary (the kernel) to be loaded into continuous physical memory starting at 0x00008000. Only a very small part of the code that is responsible for setting up an initial page table and activa...
by romell
Thu Jul 26, 2012 10:21 pm
Forum: Bare metal, Assembly language
Topic: Use of UART0
Replies: 8
Views: 7376

Re: Use of UART0

The 3MHz UART clock is at least mentioned in the firware wiki on github: "...e.g. 3MHz for UART, 50/100MHz for EMMC..." (https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface). Another way (possibly the 'correct' way) to get the clock rate is with the mailbox message "Get clock rat...
by romell
Wed Jul 25, 2012 2:08 pm
Forum: Bare metal, Assembly language
Topic: Integer division
Replies: 4
Views: 5477

Re: Integer division

Thanks for the answers. It turned out that I had simply put my -lgcc directive at the wrong place in my ld arguments. Didn't know that it what so picky about the placement... Anyway, I also found the linux kernel implementation of the division functions in the file arch/arm/lib/lib1funcs.S. Seems to...
by romell
Tue Jul 24, 2012 11:47 am
Forum: Bare metal, Assembly language
Topic: Integer division
Replies: 4
Views: 5477

Integer division

Hi, When doing any kind of integer division, I'm getting the linker error: undefined reference to `__aeabi_idiv' I tried this both with the pre-built toolchain from: launchpad.net/gcc-arm-embedded and with a gcc/newlib toolchain built with crosstool-ng... My current workaround is casting to float an...

Go to advanced search