Go to advanced search

by BrianW
Thu Oct 13, 2016 12:09 pm
Forum: Bare metal
Topic: Vector table
Replies: 7
Views: 1274

Re: Vector table

The other, other approach is simply to instruct the processor to look elsewhere for the vectors using a system co-processor call. They can be at any 32-byte aligned location. It saves a lot of messing about moving things around and linking at different addresses. I know for the Pi1, this works: mov ...
by BrianW
Thu Sep 01, 2016 2:43 pm
Forum: Bare metal
Topic: (solved) unusual STR confusion .
Replies: 9
Views: 1222

Re: unusual STR confusion .

.word 500 //#33 animation update compare register .word 36 //#37 animation update counter .word 4794*2 //#41 animation data row size This just isn't going to work how you want ARM requires that word and half-word access is suitably aligned. That is, word access has to be on a 4-byte boundary, and h...
by BrianW
Sat Aug 27, 2016 9:40 pm
Forum: Bare metal
Topic: Suspicious atags address
Replies: 10
Views: 1637

Re: Suspicious atags address

DavidS wrote:And what assembler are you using that uses C style designations for hexadecimal? All the ARM assemblers I know of use the form &F00F (using a well known Intel Opcode as example).
GCC's assembler?

Probably most assemblers would use 0x notation.
by BrianW
Thu Aug 25, 2016 9:22 am
Forum: Bare metal
Topic: Suspicious atags address
Replies: 10
Views: 1637

Re: Suspicious atags address

Hi, I notice you're storing R0-R2 on the stack using stmfd sp, {r0-r2} Generally, you would use stmfd sp!, {r0-r2} The ! causes the SP register to be updated (in this case, from 0x8000 to 0x7ff4). Without that, the next thing to use the stack will write to 0x7ffc (where your R2 register is stored) r...
by BrianW
Thu Aug 04, 2016 12:28 pm
Forum: Bare metal
Topic: First baremetal program
Replies: 6
Views: 1375

Re: First baremetal program

Did you try adding "-c" to the CLFAGS in the makefile, as suggested?
by BrianW
Thu Aug 04, 2016 10:11 am
Forum: Bare metal
Topic: First baremetal program
Replies: 6
Views: 1375

Re: First baremetal program

During linking I got a message _start not found defaults to .... Hi, Are you sure the error occurs when you link? When compiling echo.c, gcc is trying to do a full compile and link into a finished binary, and is missing a _start because you've (correctly) told it not to use the standard libraries. ...
by BrianW
Mon Nov 09, 2015 10:55 am
Forum: Bare metal
Topic: RPI2 frame buffer demonstration
Replies: 1
Views: 584

Re: RPI2 frame buffer demonstration

An HDMI-to-DVI cable is absolutely fine. I've used one without problems.

Are you using demos written/intended for an RPI1?
by BrianW
Fri Aug 14, 2015 10:56 am
Forum: Bare metal
Topic: Interrupt vectors are not copied
Replies: 2
Views: 449

Re: Interrupt vectors are not copied

turboscrew wrote:Then I checked the interrupt vectors, and they were
totally BS (except the first word), and I can't figure out why.

Code: Select all


	loop$:
	ldr r7,[r4], #4
	str	r7,[r6], #4
	subs r5, r5, #1
	beq	loop$
You're only copying the first word. The beq needs to be bne.
by BrianW
Tue Mar 04, 2014 4:49 pm
Forum: Bare metal
Topic: What do the 3bits per pin represent in the GPIO Controller
Replies: 2
Views: 815

Re: What do the 3bits per pin represent in the GPIO Controll

The 3 bits represent 8 functions each GPIO pin can perform. They are input, output, or "alternative function 0" to "alternative function 5". The alternative functions vary from pin to pin and are used to connect the pin to an internal peripheral (eg. SPI, PWM, UART). See page pages 89 and 102-104 of...
by BrianW
Wed Dec 18, 2013 1:30 pm
Forum: Bare metal
Topic: Software interrupt and MMU
Replies: 2
Views: 1938

Re: Software interrupt and MMU

Hi, At boot, the ARM MMU is turned off. You have a flat view of the memory, with RAM at 0x00000000, up to 0x1fffffff (512MB), followed by the peripherals at 0x20000000, with the memory repeating at 0x4000000, 0x80000000 and 0xc0000000. You can set up an exception vector at 0x00000008 simply by putti...
by BrianW
Mon Nov 18, 2013 4:26 pm
Forum: Bare metal
Topic: problem with malloc function
Replies: 12
Views: 2602

Re: problem with malloc function

Without seeing all of the code, it's impossible to do much more than go "yeah, that's broken". Just for instance, the code which outputs a number isn't shown, and that's where it appears to be halting. The UART code isn't shown. Do you have any interrupts enabled? Do you have exception handlers to d...
by BrianW
Mon Nov 18, 2013 1:40 pm
Forum: Bare metal
Topic: problem with malloc function
Replies: 12
Views: 2602

Re: problem with malloc function

It's tricky to say without seeing all your code, and I haven't used the watchdog myself, but 2 questions come to mind looking at the snippets you posted: Are you correctly updating the watchdog timer? Have you given the watchdog enough time? It looks like you're using 258 ticks (0x102), which doesn'...
by BrianW
Fri Nov 08, 2013 1:51 pm
Forum: Bare metal
Topic: Interrupts and Exceptions
Replies: 14
Views: 2880

Re: Interrupts and Exceptions

I would recomend using something very simple, and keeping the Vecpors at address 00. This will improve compatability if you decide to port to another ARM System. I can't agree with you on this point. Porting is probably a red herring for most people who are starting out with bare metal, and, once y...
by BrianW
Thu Nov 07, 2013 2:19 pm
Forum: Bare metal
Topic: Interrupts and Exceptions
Replies: 14
Views: 2880

Re: Interrupts and Exceptions

The problem is most likely that your exception vector is in the wrong place. By default, it *must* be at 0x0 (although you can place it at 0xFFFF0000 by setting the SCTLR.V bit). Given that the kernel loads, by default, at 0x8000, you're going to need to move your exception table after loading. A r...
by BrianW
Tue Oct 08, 2013 4:08 pm
Forum: Bare metal
Topic: Getting the most processing speed...
Replies: 24
Views: 3525

Re: Getting the most processing speed...

I still point out that your empty loop will almost always compile to between 8 and 12 instructions from C. As such you may wish to recode at least the loop in ARM assembly using two instructions. This isn't the case. A half-way decent C compiler is pretty good at optimising most code - gcc, for exa...
by BrianW
Sat Aug 24, 2013 10:58 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: L298N recap...
Replies: 11
Views: 2753

Re: L298N recap...

On page 3 is important info: it states the inputs are TTL compatible, that means that the 3V3 input from the RPi is not defined! Page 3 also clearly states that the minimum voltage on the input pins to register a logic high is 2.3V. Those boards (and the L298N generally) work absolutely fine with t...
by BrianW
Mon Aug 19, 2013 9:17 am
Forum: Bare metal
Topic: C Pointer issue
Replies: 7
Views: 1028

Re: C Pointer issue

Bosvark wrote: My issue is, that passing a pointer into a function does not have the desired result. The expected result is that val1 and val2 would be equal after the function ptr_test() returns.
What result do you get instead?
by BrianW
Mon Jul 08, 2013 6:49 pm
Forum: Interfacing (DSI, CSI, I2C, etc.)
Topic: Pi = DCC for model railways?
Replies: 34
Views: 20128

Re: Pi = DCC for model railways?

The current issue (14) of MagPi has an article dealing with adding an Input/Output processor to a Pi, in part to overcome the lack of microsecond precision timing in Linux. The author specifically mentions that this would be useful for DCC. I saw the mention of DCC in that article, and chuckled a l...
by BrianW
Wed Jul 03, 2013 4:34 pm
Forum: Bare metal
Topic: Baking Pi: A C Port
Replies: 12
Views: 2377

Re: Baking Pi: A C Port

Ah. It definitely needs to be inside the loop, otherwise the value of 'data' never changes, so the while loop will just get stuck forever. Looking at the assembler code more closely (I'm not familiar with Baking Pi beyond a cursory glance), I notice that the return value from your function is differ...
by BrianW
Wed Jul 03, 2013 3:59 pm
Forum: Bare metal
Topic: Baking Pi: A C Port
Replies: 12
Views: 2377

Re: Baking Pi: A C Port

SirSkidmore wrote:

Code: Select all

unsigned int MailboxRead(unsigned int channel)
{
    unsigned int data;

    data = *MailboxReadAddr;

    while(1)
    {
        if ((data & 15) == channel) {
            return data;
        }
    }
}
The "data = *MailboxReadAddr;" assignment needs to happen inside the while loop.
by BrianW
Wed Jul 03, 2013 1:16 pm
Forum: Bare metal
Topic: Baking Pi: A C Port
Replies: 12
Views: 2377

Re: Baking Pi: A C Port

That's odd, as those two pieces of code should be functionally identical. The one your friend suggested does the same thing in a more roundabout fashion.

More puzzlingly, when compiled, the output of the compiler is the same for both.
by BrianW
Wed Jul 03, 2013 8:39 am
Forum: Bare metal
Topic: Baking Pi: A C Port
Replies: 12
Views: 2377

Re: Baking Pi: A C Port

*((char *)GpioAddr + 4) = ra; Because you cast GpioAddr to char *, GCC is planting code to write a byte to 0x20200004 rather than the 32-bit word you need it to. Try this instead: *((volatile unsigned int *)(GpioAddr+4)) = ra; (And similar changes in the rest of your code) The "volatile" keyword is...
by BrianW
Fri Jun 28, 2013 10:42 pm
Forum: Networking and servers
Topic: Need help with a Nightclub Project! Output to Multiple Tv's!
Replies: 9
Views: 1765

Re: Need help with a Nightclub Project! Output to Multiple T

If it's not a silly question, wouldn't you be better off with a single video source and an HDMI distribution amp and some decent cable or extenders?
by BrianW
Fri Jun 28, 2013 10:23 pm
Forum: Automation, sensing and robotics
Topic: Pi's internal resistance
Replies: 12
Views: 3082

Re: Pi's internal resistance

Don't connect the motor directly to a GPIO pin. The best case scenario is that it just won't work, but you also risk serious damage to your Pi. It's just not designed to provide that much current. You need some sort of interface circuit. If you're not sure about building one yourself, your best bet ...
by BrianW
Fri Jun 21, 2013 9:40 am
Forum: Bare metal
Topic: Accessing ARMs standby-mode
Replies: 24
Views: 4421

Re: Accessing ARMs standby-mode

asmb: MOV r0, #0 ;writes a zero into r0 SVC $0 ;should somewhat bring me into supervisor mode MCR p15, 0, r0, c7, c0, 4 ;Wait For Interrupt operation MOV pc, lr ;don't know what it does exactly, needed it in other progs Fom your description, it sounds like you're running this code under Linux, rath...

Go to advanced search