moltin
Posts: 4
Joined: Sun Sep 02, 2012 10:09 pm
Location: England

Baking Pi

Sun Sep 02, 2012 10:20 pm

Firstly Alex, you inspired me to look into bare metal after having a chat at one of the university open days so I was delighted to find this tutorial.
Unfortunately I keep receiving an error on the first lesson :? and i wonder if someone who understands much more than me can help.
When I try to complete the last section whenever i type "make" I receive this error
arm-none-eabi-ld --no-undefined -Map kernel.map -o build/output.elf -T kernel.ld
arm-none-eabi-ld: no input files
make: *** [build/output.elf] Error 1
Which unfortunately means absolutely nothing to me and rather unlike anything on the troubleshooting as far as I can tell.
Does anyone know what is going wrong?

Thanks in advanced

User avatar
Cremno
Posts: 2
Joined: Sun Sep 02, 2012 10:49 pm
Location: Germany

Re: Baking Pi

Sun Sep 02, 2012 10:56 pm

You have to create a directory called source. Move your main.s into it and make again.

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Mon Sep 03, 2012 5:23 am

Yes Cremno is right, that error is caused by make not finding any assembly code files in the source directory. I'll add it to the troubleshooting page when I get chance.

moltin
Posts: 4
Joined: Sun Sep 02, 2012 10:09 pm
Location: England

Re: Baking Pi

Mon Sep 03, 2012 8:36 am

Thanks
I imagined it would have been something simple that I had misread when doing it :oops:
Last edited by moltin on Mon Sep 03, 2012 8:53 am, edited 2 times in total.

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Mon Sep 03, 2012 8:42 am

No trouble, it's the kind of thing that is easily missed, and the error message isn't obvious if you're not familiar with it.

moltin
Posts: 4
Joined: Sun Sep 02, 2012 10:09 pm
Location: England

Re: Baking Pi

Mon Sep 03, 2012 8:53 am

Im sorry I still can't get it to work. Where do I have to make the source directory?

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Mon Sep 03, 2012 8:58 am

Your directory structure should look something like:

Code: Select all

build/
source/
    main.s
makefile
kernel.ld
If you're having trouble you can always download the answer to the exercise on the downloads page, and then work it out from that.

moltin
Posts: 4
Joined: Sun Sep 02, 2012 10:09 pm
Location: England

Re: Baking Pi

Mon Sep 03, 2012 10:05 am

Ive downloaded the completed sample and I think the problem was because it was saving as main.s.txt :lol:
Would that have caused my problem?

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Mon Sep 03, 2012 10:07 am

Yes, that would do it! I assume that'll be Notepad's doing, it is quite annoying for that sort of thing. ;) At least you know now. I'll probably mention that somewhere.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Baking Pi

Mon Sep 03, 2012 10:45 pm

@Alex when i run your input demos they compile fine, but i get no output from keyboard.
I have tried 3 different keyboards, but no joy.
What ver of boot loaders are you using and what info do you need ?.

The other demos i have try seem to work fine.
Batteries not included, Some assembly required.

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Tue Sep 04, 2012 7:50 am

I think the USB driver may need some work actually, I've now tried it on 9 keyboards, and only 3 worked. I'm using a control transfer to retrieve key inputs, when the standard suggests that interrupt transfers are much preffered, so perhaps not all keyboards have implemented the control transfers properly. I'll try to get it working soon. I should have the source for the driver up on GitHub sometime today, so you can compile a version with logging to see what is going on.

blavery
Posts: 95
Joined: Sun Jul 01, 2012 2:57 am
Location: QLD. Australia

Re: Baking Pi

Tue Sep 04, 2012 9:29 am

Brilliant stuff.

But confirm that "input" kernel image gives no keyboard to screen for me either.
I'm using latest rpi-update booting files. Also using
"sdhci-bcm2708.sync_after_dma=0 dwc_otg.fiq_fix_enable=1 dwc_otg.speed=1"
just in case those might be relevant.

But I just noticed the MAKE process spat several lines of
Warning: ./libcsud.a/(...): Unknown EABI object attribute 44
That seems suspicious.
Make was done directly from the "Full Solution" files on the Cambridge Baking Pi site.

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Tue Sep 04, 2012 9:37 am

Just to double check, did anything display on screen at all? Input02 should produce some text, so if that doesn't display, the screen could be the issue.

Those warnings could be important. What OS are you compiling from? I think the Windows and Mac compilers are identical, but the Linux one was from a different source. I never thought to test it for differences with the driver, so that may need looking into.

blavery
Posts: 95
Joined: Sun Jul 01, 2012 2:57 am
Location: QLD. Australia

Re: Baking Pi

Tue Sep 04, 2012 9:48 am

Wow, fast reply! 8pm here.
NO output to screen, either for HDMI or for AV mode.
Main machine here = mint debian.
Keyboard #1 = wireless iPazzPort kbd/mousepad. Ok, so it might have been the wireless side being a problem. So kbd#2 = stock cheap usb wired keyboard. But still no luck.
I still need to check that dwc_otg.speed=1 option (that messes with usb).
And I confess to leapfrogging the middle tutorials. I should backtrack.

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Tue Sep 04, 2012 9:54 am

11 am here!

First of all I would make sure that you can get the screen working on a simpler tutorial (screen01 does seem the obvious choice!). Once that's working, then we'll know if it's the keyboard or the screen that is the problem. The command line file is ignored, but some people have found changing the settings in config.txt (read by the Broadcom code) can fix problems.

blavery
Posts: 95
Joined: Sun Jul 01, 2012 2:57 am
Location: QLD. Australia

Re: Baking Pi

Tue Sep 04, 2012 10:41 am

Screen01 fail also.
Recompiled screen01 with framebuffer 480x320 (in case my low video start.elf might be limiting buffer size??).
No screen output (beyond the coloured flash that I presume is the usual rainbow splash for a tiny instant).
Screen is active black. Green LED finishes off.

So far, I believe the code is not returning from
bl InitialiseFrameBuffer

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Tue Sep 04, 2012 11:20 am

Have you tried unplugging and reinserting the HDMI cable while it is running? That broke the infinite loop in InitialiseFrameBuffer problems for me.

Alternatively, add kernel_old=1 to the config.txt, and if that fails hdmi_safe=1.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Baking Pi

Tue Sep 04, 2012 12:53 pm

Thanks for reply and in my case with Input02 i get no screen output ether, the screen does come on, but its just black.
I have tested other screen demos and they work fine.
I will do more test and see what i can find.
Batteries not included, Some assembly required.

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Tue Sep 04, 2012 1:09 pm

DexOS, did you try with kernel_old=1? I know it can solve addressing issues that don't affect Screen01, but certainly do affect the later examples.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Baking Pi

Tue Sep 04, 2012 1:38 pm

Chadderz wrote:DexOS, did you try with kernel_old=1? I know it can solve addressing issues that don't affect Screen01, but certainly do affect the later examples.
Thanks for the info, i tryed screen4, it did not print anything to screen.
Then i added "kernel_old=1" and then "screen4" print to screen.

So now i will test the keyboard input2, with that in config.txt and let you know if it works.
Batteries not included, Some assembly required.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Baking Pi

Tue Sep 04, 2012 2:15 pm

Good news, "kernel_old=1" fixed it. Works great with all 3 USB keyboards i have and also works with a hid temperature sensor that i have.
You have done very well to get bare metal usb working, i am impressed.

Note: there's a big difference in input speed between the difference keyboards.

In my bare metal OS, to use the latest bootloaders the kernel needs to have a org of 0x8000, as kernel.img is loaded to 0x8000 by bootloader, have you tried using that ?.

And thanks again.
Batteries not included, Some assembly required.

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Tue Sep 04, 2012 3:09 pm

That's fantastic news, I was worried about the 3/9 keyboards but 6/12 isn't bad. What did it do with the temperature sensor?

I always had the boot loader which puts the kernel.img at 0, and then it was pointed out to me that it had changed. Since the new one looks like its here to stay, it may be as well to just load at 0x8000, however I started using kernel_old=1 for simplicity and compatibility. I also feel slightly cheated that we have to use the perscribed version of the first 32k ;)

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Baking Pi

Tue Sep 04, 2012 3:18 pm

Chadderz wrote:I also feel slightly cheated that we have to use the perscribed version of the first 32k ;)
There's upsides and downsides to it. The downside, obviously, is that you lose 32k, and have to write a little loop to shove your vector table into place. The upside is that you get to use the kernel command line for your own nefarious purposes (mine, for example, contains a uart device driver and repl written in scheme), you get the "standard" kernel atags (which saves trying to work out how much memory you have manually), and you can always use that 32k (less 32 bytes of vectors) for scratchpad space later if you want.

Simon

User avatar
Chadderz
Posts: 64
Joined: Thu Aug 30, 2012 12:50 pm
Location: Cambridge, UK

Re: Baking Pi

Tue Sep 04, 2012 3:23 pm

Ah, you always could get the ATAGs and command line actually (Screen04), the old boot loader also put it at 0x100, it just overwrote what ever was there! It's true, I wouldn't lose much though since the .text section is at 0x8000 for me anyway.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Baking Pi

Tue Sep 04, 2012 4:34 pm

Chadderz wrote:That's fantastic news, I was worried about the 3/9 keyboards but 6/12 isn't bad. What did it do with the temperature sensor?

I always had the boot loader which puts the kernel.img at 0, and then it was pointed out to me that it had changed. Since the new one looks like its here to stay, it may be as well to just load at 0x8000, however I started using kernel_old=1 for simplicity and compatibility. I also feel slightly cheated that we have to use the perscribed version of the first 32k ;)
The temperature sensor is a modded one of these http://proto-pic.co.uk/avr-stick/

And the new bootload load address caught a lot of us out, i now include the boot loaders that work with the tuts, to make sure they have the right setup.
Batteries not included, Some assembly required.

Return to “Bare metal, Assembly language”