Go to advanced search

by valtonia
Thu Jun 19, 2014 9:28 pm
Forum: Bare metal, Assembly language
Topic: c libs
Replies: 7
Views: 2198

Re: c libs

Here's a really ancient all-c library that gives you most of the basic functions. It doesn't include printf as that's quite platform specific. I don't remember where this code came from now - it might even have been from a book! Anyway, it might be enough to get you started. http://pastebin.com/C8yh...
by valtonia
Fri Feb 14, 2014 10:28 pm
Forum: Bare metal, Assembly language
Topic: Defining addresses and bit-fields with structs
Replies: 12
Views: 3113

Re: Defining addresses and bit-fields with structs

As DWelch pointed out, this is probably flame-bait, but here's my experience of bit-fields; I used to work for a company producing digital set-top boxes (and other related products). All coding was in C and based on both MIPS and ARM processors - not even a hint of Intel in embedded systems back the...
by valtonia
Tue Sep 24, 2013 11:12 pm
Forum: Bare metal, Assembly language
Topic: Floating point hanging
Replies: 7
Views: 2779

Re: Floating point hanging

The other thing I found helped when I had this hanging issue was to just use gcc for everything, passing the same flags for both assembly and .c - rather then having separate lines in the makefile for each. It seems that by doing it this way gcc figures out what needs to be done and supplies the app...
by valtonia
Tue Sep 17, 2013 8:27 pm
Forum: Bare metal, Assembly language
Topic: Floating point hanging
Replies: 7
Views: 2779

Re: Floating point hanging

Hi, Sorry, I didn't spot that it was the same code! :D The other thing you'll need is to include these assembler flags in your makefile -mfpu=vfp -mhard-float at least, if you're using the same gcc as me (I'm not sure what it's called but the path to looks like this: /usr/local/arm-bcm2708/x86-linux...
by valtonia
Fri Sep 13, 2013 8:01 pm
Forum: Bare metal, Assembly language
Topic: Floating point hanging
Replies: 7
Views: 2779

Re: Floating point hanging

You need to initialise the FPU before using it. What you're seeing is your code causing an unknown instruction exception. The one I use is by D Welch. mrc p15, 0, r0, c1, c0, 2 orr r0, r0, #0x300000 @ single precision orr r0, r0, #0xC00000 @ double precision mcr p15, 0, r0, c1, c0, 2 mov r0, #0x4000...
by valtonia
Fri Apr 26, 2013 9:13 pm
Forum: Bare metal, Assembly language
Topic: Pixels in 24 bit resolutions
Replies: 1
Views: 822

Re: Pixels in 24 bit resolutions

While not the most efficient way to do it, this works. Where x and y is the pixel location and c is the colour. This routine will work for all bit-depths, in this example I've hard-coded fb_depth to be 24. void set_pixel(unsigned int x, unsigned int y, unsigned int c) { volatile unsigned char *pixel...
by valtonia
Sun Feb 10, 2013 4:54 pm
Forum: Bare metal, Assembly language
Topic: Using DMA for a FillBlt
Replies: 4
Views: 1435

Re: Using DMA for a FillBlt

This is how I transfer a "sprite" from contiguous memory to the screen, using a single DMA setup - it's broadly similar to what you describe in your previous post, but I thought some code might make it clearer for other folk. In my code I set up structs/unions using the names of the registers and bl...
by valtonia
Fri Dec 07, 2012 11:04 pm
Forum: Bare metal, Assembly language
Topic: 8 bit colour palette information
Replies: 22
Views: 8290

Re: 8 bit colour palette information

Here's arm_to_vc unsigned int arm_to_vc(void *p) { return ((unsigned int)p) + 0xC0000000; } The memory barrier function is just the standard one you can find floating around all over this forum, usually in asm. The one I used is by dwelch. memory_barrier: mcr p15, 0, ip, c7, c5, 0 @ invalidate I cac...
by valtonia
Mon Dec 03, 2012 10:40 pm
Forum: Bare metal, Assembly language
Topic: 8 bit colour palette information
Replies: 22
Views: 8290

Re: 8 bit colour palette information

Hey -rst-, here ya go! First, check out the mailbox i/f documentation: https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface This is the code I'm using (at least, enough of it that should be useful to you): #define BCM2708_PERI_BASE 0x20000000 #define GPUCORE_MAILBOX (BCM2708_PERI_...
by valtonia
Thu Nov 29, 2012 11:32 pm
Forum: Bare metal, Assembly language
Topic: 8 bit colour palette information
Replies: 22
Views: 8290

Re: 8 bit colour palette information

Yeah, pretty much - if you look at the function I posted early on in this thread you'll see the last(ish) line is really just that same code you mention. The rest of the function is for converting a full 24-bit colour to its nearest 8-bit web safe equivalent. The reason I did that was because my gra...
by valtonia
Sun Nov 25, 2012 10:27 pm
Forum: Bare metal, Assembly language
Topic: 8 bit colour palette information
Replies: 22
Views: 8290

Re: 8 bit colour palette information

I think you're asking this in the wrong forum - as this is a bare metal forum I doubt that people here will have much experience with the Linux kernel driver. I've been away from RPi development for a while due to work pressure (I do have to earn a living writing code as well as playing with the RPi...
by valtonia
Fri Aug 17, 2012 1:36 pm
Forum: Bare metal, Assembly language
Topic: Help with PCM block
Replies: 3
Views: 1405

Help with PCM block

Hi All, I'm trying to get the PCM block working, trying a simple test (in polling mode) to just get some noise out of the Rpi and it's sort of half working, but behaving in strange way. First, the sync bit in the cs_a register - the doc says write 1 to this and 2 clocks later it will read back as 1....
by valtonia
Tue Aug 14, 2012 9:36 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: STICKY: The I2S sound thread.
Replies: 902
Views: 437636

Re: I2S: Anyone got it running?

Hi Guys, I normally hang out in the bare metal section but I noticed this post and thought you might be able to help me. I'm trying to get the PCM block working, trying a simple test (in polling mode) to just get some noise out of the Rpi and it's sort of half working, but behaving in strange way. F...
by valtonia
Sat Aug 04, 2012 2:02 pm
Forum: Bare metal, Assembly language
Topic: Mailbox property interface->Suggestions
Replies: 5
Views: 2747

Re: Mailbox property interface->Suggestions

Hey @dom,

Do you have any example code for doing arbitrary 8-bit alignment DMA? From the doc's I could only see 32 bit or 128 bit, and I couldn't get the 32 bit to work correctly.

Cheers,
V.
by valtonia
Sat Aug 04, 2012 8:58 am
Forum: Bare metal, Assembly language
Topic: Bare Metal VideoCore
Replies: 27
Views: 11903

Re: Bare Metal VideoCore

Also, there is talk of a new firmware release, the one that was used for the Android 4 port, which gives more access to the videocore - particularly the accelerated graphics. There's a story on the main Rpi page about it, and this is where they say they're hoping to release the firmware for general ...
by valtonia
Fri Aug 03, 2012 9:08 pm
Forum: Bare metal, Assembly language
Topic: Framebuffer Speed
Replies: 18
Views: 6808

Re: Framebuffer Speed

@Cycl0ne I just tried recompiling my (mainly framebuffer) stuff with -O3 (I'd also been using -O0 while trying to get everything working) and it is indeed an order of magnitude faster. I also don't see any code disappearing. I'm using the arm-bcm2708hardfp-linux-gnueabi-gcc stuff. I also have a DMA ...
by valtonia
Fri Aug 03, 2012 8:27 pm
Forum: Bare metal, Assembly language
Topic: Bare metal OS, DMA reset problem (solved)
Replies: 8
Views: 4722

Re: Bare metal OS, DMA reset problem (solved)

Hi PG,

Things are going well, but slowly - I'd forgotten how much fun coding at this level was. I used to work for a big STB maker and write driver code etc for them. These days I work on web apps but I always wanted to get back into low level stuff.

V.
by valtonia
Tue Jul 24, 2012 10:23 pm
Forum: Bare metal, Assembly language
Topic: Bare metal motivations
Replies: 8
Views: 3639

Re: Bare metal motivations

My approach is a combination of a bit of nostalgia for me from my Spectrum / C64 / BBC coding days (yes I really am that old!) and to try to provide that same environment to kids now, without the learning curve of Linux + Python. So, I'm hoping to produce what I call a "switch on and code" system, w...
by valtonia
Tue Jul 24, 2012 10:11 pm
Forum: Bare metal, Assembly language
Topic: Integer division
Replies: 4
Views: 5479

Re: Integer division

Alternatively, if you're using the toolchain that's used to build the linux kernel (not sure what it's called), the command will look something like: /arm-bcm2708/x86-linux64-cross-arm-linux-hardfp/bin/arm-bcm2708hardfp-linux-gnueabi-gcc You just need to link the supplied libgcc.a. Here's my Makefil...
by valtonia
Wed Jul 18, 2012 10:32 pm
Forum: Bare metal, Assembly language
Topic: 8 bit colour palette information
Replies: 22
Views: 8290

Re: 8 bit colour palette information

@DexOS

Yes, on further investigation 32bpp is 8Ax8Bx8Gx8R as you say. Good catch.

V.
by valtonia
Wed Jul 18, 2012 9:46 pm
Forum: Bare metal, Assembly language
Topic: 8 bit colour palette information
Replies: 22
Views: 8290

8 bit colour palette information

As part of my ongoing OS development (read: playtime) I've been messing around with the framebuffer and all of the graphicy goodness that comes with it. So far I've developed things like plotting a pixel, drawing lines and circles etc. I've also got this working in 32/24/16 and 8 bit colour modes. T...
by valtonia
Sat Jul 14, 2012 4:54 pm
Forum: Bare metal, Assembly language
Topic: Floating point in bare metal code
Replies: 11
Views: 6058

Re: Floating point in bare metal code

@Cycl0ne

Full details of the VFP FPU are here:

http://infocenter.arm.com/help/topic/co ... p7_trm.pdf

I haven't read that much into it yet - will update here when I know more.

V.
by valtonia
Sat Jul 14, 2012 4:09 pm
Forum: Bare metal, Assembly language
Topic: Floating point in bare metal code
Replies: 11
Views: 6058

Floating point in bare metal code

Just thought I'd post this up as it may save others some time when trying to get floating point working in their bare metal projects. Assuming you are using the arm-bcm2708hardfp-linux-gnueabi-* tools (used for building the Linux kernel) and you're linking against libgcc, you: need to add -mhard-flo...
by valtonia
Thu Jul 12, 2012 11:55 am
Forum: Bare metal, Assembly language
Topic: [BareMetal] USB
Replies: 31
Views: 11035

Re: [BareMetal] USB

@Cycl0ne I would be very interested in getting an early look at your code. I was just about to start in on a usb driver for my own bare-metal os, so this could save some time. Like you, I was waiting to get to a specific point functionality-wise before publishing my code, but if anything I've done i...
by valtonia
Thu Jul 05, 2012 9:55 pm
Forum: Bare metal, Assembly language
Topic: Bare metal OS, DMA reset problem (solved)
Replies: 8
Views: 4722

Re: Bare metal OS, DMA reset problem

@Dom D'Oh! That was it! Thanks. I don't how many times I must've read this line in DMA section of the technical document without connecting the dots! :roll: > Beware that the DMA controller is direcly connected to the peripherals. Thus the DMA controller must be set-up to use the Physical (harware) ...

Go to advanced search