Go to advanced search

by blm768
Fri Mar 29, 2013 6:51 am
Forum: Bare metal, Assembly language
Topic: Interrupt Theory
Replies: 23
Views: 9852

Re: Interrupt Theory

I am now assuming that my linker.ld file is messing up the data positions and preventing me from being able to access memory of any kind. I think the only reason I can draw colors to the framebuffer is because I hard-code the memory location of the structure I pass to the mailbox. If your linkscrip...
by blm768
Wed Mar 27, 2013 7:56 am
Forum: Bare metal, Assembly language
Topic: Interrupt Theory
Replies: 23
Views: 9852

Re: Interrupt Theory

Here's the code I'm using for my IVT: .ivt: ldr pc, .isrs ldr pc, .isrs + 4 ldr pc, .isrs + 8 ldr pc, .isrs + 12 ldr pc, .isrs + 16 ldr pc, .isrs + 20 ldr pc, .isrs + 24 ldr pc, .isrs + 28 .isrs: .word _start .word halt .word swi_handler .word halt .word halt .word halt .word irq_handler .word halt ...
by blm768
Sat Mar 23, 2013 6:52 am
Forum: Bare metal, Assembly language
Topic: Interrupt Theory
Replies: 23
Views: 9852

Re: Interrupt Theory

Upon further investigation, I found 0x0001C ( + 0x20000000 ) = GPSET0 . But the SoC document says you just use that address to set a bit on/off to mark whether it's an output pin or not (I think). On an ARM processor, when an interrupt is triggered, the processor jumps to a fixed memory location. T...
by blm768
Wed Jan 09, 2013 4:50 am
Forum: Bare metal, Assembly language
Topic: ATAGS
Replies: 3
Views: 1317

Re: ATAGS

I think I've got it figured out; the length field is in words, not in bytes. I'll test it out when I get a chance.
by blm768
Tue Jan 08, 2013 3:44 pm
Forum: Bare metal, Assembly language
Topic: ATAGS
Replies: 3
Views: 1317

ATAGS

I've been writing some code to process the ATAGS so I can get a memory map, but I'm having some difficulty actually getting useful values. It appears that the ATAG_CORE is there as expected, but its page size field is set to zero, and it's immediately followed by an ATAG_END. Am I just missing an op...
by blm768
Sun Dec 09, 2012 7:15 pm
Forum: Bare metal, Assembly language
Topic: VideoCore mailboxes
Replies: 16
Views: 3609

Re: VideoCore mailboxes

Oh... it's an operator precedence issue. I see what it's doing now.

Thanks for your help!
by blm768
Sun Dec 09, 2012 12:15 pm
Forum: Bare metal, Assembly language
Topic: VideoCore mailboxes
Replies: 16
Views: 3609

Re: VideoCore mailboxes

Hmm... so it's working with the recv_message function being given an argument of 15 when it theoretically should be 1...

I'll have to take a look at that pointer. If it's being set, something really strange is going on.

How do you implement your MailBoxRead() function?
by blm768
Sun Dec 09, 2012 3:04 am
Forum: Bare metal, Assembly language
Topic: VideoCore mailboxes
Replies: 16
Views: 3609

Re: VideoCore mailboxes

I tried removing the routine, but I'm still getting the same results. Could you post the code you're using?
by blm768
Sat Dec 08, 2012 10:42 am
Forum: Bare metal, Assembly language
Topic: VideoCore mailboxes
Replies: 16
Views: 3609

Re: VideoCore mailboxes

Here's the code for my struct (both definition and initialization): typedef struct { uint width, height; uint vWidth, vHeight; volatile uint pitch; uint depth; uint x, y; color_rgb* volatile buffer; volatile size_t size; } __attribute__((__aligned__(16))) FramebufferInfo; FramebufferInfo fb = { 1024...
by blm768
Sat Dec 08, 2012 2:32 am
Forum: Bare metal, Assembly language
Topic: VideoCore mailboxes
Replies: 16
Views: 3609

Re: VideoCore mailboxes

phil95 wrote:Exact, my send_message reshift the parameter left of 4 befor the or.with id.
Are you sure, low nibble of &fb is null ?
Philippe
It is; I set an alignment attribute on it, and I verified in the disassembly that it's 16-byte aligned.
by blm768
Fri Dec 07, 2012 5:33 pm
Forum: Bare metal, Assembly language
Topic: VideoCore mailboxes
Replies: 16
Views: 3609

Re: VideoCore mailboxes

Sorry, I think the line must be: send_message(1, (int)(((unsigned long)(&fb) + 0x40000000)) >> 4); Philippe I don't think that's it; my send_message function doesn't do any shifting internally, just a bitwise OR. Shifting would make the address overlap the mailbox number. I'm starting to wonder if ...
by blm768
Thu Dec 06, 2012 7:20 pm
Forum: Bare metal, Assembly language
Topic: VideoCore mailboxes
Replies: 16
Views: 3609

Re: VideoCore mailboxes

Hello I think you have a problem in line: send_message(1, (int)(&fb + 0x40000000)); &fb is a pointer to a struct; &fb + n is a pointer to fb + n * sizeof (struct); try: send_message(1, (int)((unsigned long)(&fb) + 0x40000000)); Philippe Oh... duh! I should have caught that. :oops: Unfortunately, I'...
by blm768
Thu Dec 06, 2012 7:36 am
Forum: Bare metal, Assembly language
Topic: VideoCore mailboxes
Replies: 16
Views: 3609

VideoCore mailboxes

For some reason, I'm having a really tough time getting any messages from the VideoCore mailboxes. Currently, I'm getting a mailbox value of 15, which doesn't even seem to be a used mailbox channel. Here's the code I'm using: #define MAIL_RECV (*(volatile uint*)0x2000B880) #define MAIL_PEEK (*(volat...
by blm768
Tue Dec 04, 2012 9:05 am
Forum: Bare metal, Assembly language
Topic: Baking Pi screen01
Replies: 49
Views: 11004

Re: Baking Pi screen01

As it turns out, the message wasn't giving a success code. For some reason, I had it in my head that 0 was the success code. :) I guess I'd better figure out why it's not liking my call... Edit: Could the problem be due to the lack of a memory barrier? Where should I put one to ensure that accesses ...
by blm768
Wed Nov 28, 2012 7:11 pm
Forum: Bare metal, Assembly language
Topic: simple OS functionality
Replies: 6
Views: 2924

Re: simple OS functionality

1. Could basic functionality (such as LED, screen, input in Baking Pi) be written in C instead of assembly? What about C++? What readings do you recommend about C or C++ OS bare metal programming (OS building) on Pi? Most of it can be done in C/C++, but you'll probably still need a bit of assembly ...
by blm768
Tue Nov 27, 2012 6:28 pm
Forum: Bare metal, Assembly language
Topic: Understanding the system timer
Replies: 9
Views: 5196

Re: Understanding the system timer

Is linux really using those timer interrupts? I would assume it is using the other timers and staying away from the system timer? If linux is using them then that would imply the information (interrupt number, etc) is "documented" in the linux code. IIRC, one of the other threads mentioned that Lin...
by blm768
Tue Nov 27, 2012 4:51 pm
Forum: Bare metal, Assembly language
Topic: Baking Pi screen01
Replies: 49
Views: 11004

Re: Baking Pi screen01

Still no luck getting the code to work; I think I'll compare my code against some examples and try to find where mine is different. Is there an example that works more consistently than others?
by blm768
Tue Nov 27, 2012 4:46 pm
Forum: Bare metal, Assembly language
Topic: Understanding the system timer
Replies: 9
Views: 5196

Re: Understanding the system timer

Hmm... That seems to make sense. I'll have to try that. One of these days, I'll need to get my graphics code working. I don't have any cables for the GPIO headers, so I'm just using the OK LED. What I could really use is a JTAG interface; I might have to look at getting one. One thing that worries m...
by blm768
Tue Nov 27, 2012 9:15 am
Forum: Bare metal, Assembly language
Topic: Understanding the system timer
Replies: 9
Views: 5196

Understanding the system timer

I've been trying to decipher the documentation on the system timer, and it seems rather sparse. I can't figure out where to enable the system timer interrupt; there aren't any bits marked as being related to system timer interrupts in the IRQ enable registers or in the system timer registers. I'm as...
by blm768
Sat Nov 24, 2012 9:01 pm
Forum: Bare metal, Assembly language
Topic: Baking Pi screen01
Replies: 49
Views: 11004

Re: Baking Pi screen01

With cache involved, there are many solutions that work on the surface some times, but doesn't work when pushed. That's definitely true. I kind of miss x86 cache coherency, but the hardware for that must have been a real pain to implement. Actually your definition of MAIL_SEND is missing a volatile...
by blm768
Sat Nov 24, 2012 7:12 am
Forum: Bare metal, Assembly language
Topic: Baking Pi screen01
Replies: 49
Views: 11004

Re: Baking Pi screen01

You are not subtracting 0x40000000 from fb.buffer. Safest is probably to just clear the upper 4 bits. That's true, but I was going to test it that way anyway because I got it half-working without adding/subtracting any offsets. It probably wouldn't work, but I'm curious. Before I can do that, thoug...
by blm768
Fri Nov 23, 2012 11:27 pm
Forum: Bare metal, Assembly language
Topic: Baking Pi screen01
Replies: 49
Views: 11004

Re: Baking Pi screen01

I'm also trying to write a Screen01-type program, and I end up with problems even when I add the 0x40000000 offset. I get a success message from the GPU, but my pointer is never set. Here's the code I'm using: #include <stdbool.h> #include <stddef.h> typedef signed char byte; typedef unsigned char u...
by blm768
Mon Nov 19, 2012 6:38 pm
Forum: Bare metal, Assembly language
Topic: Interrupt programming
Replies: 11
Views: 7010

Re: Interrupt programming

OK; I think I get it now. The datasheet was a little confusing, especially for someone who's just getting started with ARM internals. The code definitely looks useful; I'll have to borrow a few snippets. Too bad QEMU doesn't support the Pi's hardware; I'll have to wait for my board before I can actu...
by blm768
Sun Nov 18, 2012 6:26 am
Forum: Bare metal, Assembly language
Topic: Interrupt programming
Replies: 11
Views: 7010

Interrupt programming

I've recently been writing some code to handle interrupts, and I'm trying to find information about the Pi's interrupt system. I've found some basic information in the SoC datasheet, but it isn't quite enough to complete my implementation. Does anyone know of a resource that's a bit more comprehensi...

Go to advanced search