Go to advanced search

by gin
Tue Nov 12, 2013 4:43 am
Forum: Bare metal, Assembly language
Topic: Debugging Bare-Metal Programs
Replies: 18
Views: 9536

Re: Debugging Bare-Metal Programs

I don't see why your host environment matters - the overwhelming majority of ARM bare metal development is done on x86 anyways. I agree with using a JTAG debugger as the best choice. The only real downside is they cost more than the Raspberry Pi itself and you need the Rev. 2 (unless you want to sol...
by gin
Fri May 24, 2013 7:39 am
Forum: Bare metal, Assembly language
Topic: [SOLVED] Modulo __aeabi_uidivmod wrong result
Replies: 6
Views: 2137

Re: Modulo __aeabi_uidivmod wrong result

Read the reply by jnc100 » Thu May 23, 2013 7:11 pm __aeabi_uidivmod is a routine that does a div and a mod. Your implementation just does a mod, and stores it in the wrong register so whenever the compiler uses it for divides or mods you are getting garbage. Rewrite it so that the division result i...
by gin
Thu Mar 21, 2013 6:00 am
Forum: Bare metal, Assembly language
Topic: FreeRTOS Sucessfully Ported
Replies: 47
Views: 61566

Re: FreeRTOS Sucessfully Ported

When you use asm statements you have to tell the compiler what is being read/written/trashed.

You want something like:

volatile __asm("bl vTaskIncrementTick" : /*in*/ : /*out*/ : /*trashed*/ "lr" );

Doing that it will know to push/pop the link register.
by gin
Mon Sep 10, 2012 12:19 am
Forum: Bare metal, Assembly language
Topic: Clock speeds in bare metal?
Replies: 16
Views: 6853

Re: Clock speeds in bare metal?

Try: uint32_t controlRegister; asm volatile ("MRC p15, 0, %0, c1, c0, 0" : "=r" (controlRegister)); asm volatile ("MCR p15, 0, %0, c1, c0, 0" :: "r" (controlRegister)); Surely that's going to do nothing, as you're just reading from the control register, then putting back the value that was already ...
by gin
Sun Sep 09, 2012 8:19 pm
Forum: Bare metal, Assembly language
Topic: Clock speeds in bare metal?
Replies: 16
Views: 6853

Re: Clock speeds in bare metal?

Try:
uint32_t controlRegister;
asm volatile ("MRC p15, 0, %0, c1, c0, 0" : "=r" (controlRegister));
asm volatile ("MCR p15, 0, %0, c1, c0, 0" :: "r" (controlRegister));

It should make a decent difference.
by gin
Sat Sep 08, 2012 11:54 pm
Forum: Bare metal, Assembly language
Topic: Flashing the LED 5 times.
Replies: 23
Views: 6165

Re: Flashing the LED 5 times.

Cool, its a new arm instruction on me, it seem to assemble ok. It's the BL instruction but just with certaion conditional bits set. Every ARM instruction can be executed condionally with different mnemonics added to the end of the instruction: http://infocenter.arm.com/help/index.jsp?topic=/com.arm...
by gin
Thu Sep 06, 2012 3:47 am
Forum: Bare metal, Assembly language
Topic: Beginning with Bare Metal
Replies: 52
Views: 20054

Re: Beginning with Bare Metal

My first attempt was to pull down the fourth bootloader (as it seemed the most complete), but it seemed to be relying on a serial connection which I do not have and do not really want to set up. blinker01 looks complete (I think it says it just has a small stack). The binary stuff looks like it was...
by gin
Thu Sep 06, 2012 3:38 am
Forum: Bare metal, Assembly language
Topic: EMMC - can't get READ_RDY
Replies: 22
Views: 7926

Re: EMMC - can't get READ_RDY

If CMD3 is really the first thing you're sending the card, it may be a problem. The complete command sequence I use to set up the card initially is: GO_IDLE_STATE SD_SEND_IF_COND APP_CMD, SD_SEND_OP_COND (repeat until Powerup bit is set) ALL_SEND_CID SEND_RELATIVE_ADDR SEND_CSD SELECT_CARD SET_BLOC...
by gin
Tue Sep 04, 2012 6:15 am
Forum: Bare metal, Assembly language
Topic: EMMC - can't get READ_RDY
Replies: 22
Views: 7926

Re: EMMC - can't get READ_RDY

Has anyone had any luck getting this working? Everytime I try to set the response length flags I get the error bit set in the INTERRUPT register. My setup routine is: No setting up and GPIO selection register or pull up registers because it looks like eMMC is setup by default. *CONTROL0 = 0 *CONTROL...
by gin
Tue Sep 04, 2012 2:08 am
Forum: Bare metal, Assembly language
Topic: Beginning with Bare Metal
Replies: 52
Views: 20054

Re: Beginning with Bare Metal

Yeah, I know I first started off using your examples so I could see that being the case. :D Stuff in the .bss section isn't uninitialized, though - it is initialized to zero. GCC won't give you any warning when it puts stuff there legally, it just generates a smaller ELF file since it doesn't have t...
by gin
Mon Sep 03, 2012 10:30 pm
Forum: Bare metal, Assembly language
Topic: Beginning with Bare Metal
Replies: 52
Views: 20054

Re: Beginning with Bare Metal

One thing I've noticed missing from a lot of RPi startup code which is pretty important is initializing the .bss section in the startup routine. Without this, anything the compiler decides to put in this section thinking it will be initialized to zero won't necessarily be zero when you run it and yo...
by gin
Sun Sep 02, 2012 10:13 pm
Forum: Bare metal, Assembly language
Topic: this just hit my radar...
Replies: 18
Views: 4924

Re: this just hit my radar...

Ah awesome - I had just started working on a USB driver but found it difficult to get started because the only documentation I could find was the Linux source code for the RPi. Thanks for creating this tutorial - I can't wait to read through it.

Go to advanced search