Got bare bones graphics working

General programming chat and advice for beginners

58 posts   Page 2 of 3   1, 2, 3
by rurwin » Sat Jun 16, 2012 10:19 am
nick.mccloud wrote:On the Pi, the kernel HAS to be on the SD card
Not totally true: there has to be a file on the boot partition that we write, but it could just be another level of boot-loader.
User avatar
Forum Moderator
Forum Moderator
Posts: 2903
Joined: Mon Jan 09, 2012 3:16 pm
by Narishma » Sat Jun 16, 2012 10:33 am
rurwin wrote:Not totally true: there has to be a file on the boot partition that we write, but it could just be another level of boot-loader.

Which is basically what he says in the rest of the sentence you didn't quote.
Posts: 151
Joined: Wed Nov 23, 2011 1:29 pm
by DexOS » Sat Jun 16, 2012 2:19 pm
toxibunny wrote:Image

google 'sd slot extender' :)

Thanks, As these look ideal, but i can not find a UK suppler.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by DexOS » Sat Jun 16, 2012 2:30 pm
nick.mccloud wrote:On the Pi, the kernel HAS to be on the SD card - once it's got started it can then look for the rest of the files where ever you tell it to, if it has the code and drivers to do so.


There two choses for this, write code to read/write SD card (not too hard) or as a temple measure, stick a floppy.img to end of kernel (kernel is very small anyway) and read from it with a basic fat driver.

Something like winimage could be used to add files to the image.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by DexOS » Sun Jun 17, 2012 6:37 pm
Just a screenshot of DexOS working with Hdmi, plus my new R PI setup.

Image

Image
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by pygmy_giant » Thu Jun 21, 2012 7:05 pm
Cool - can Joe Public get this?
Ostendo ignarus addo scientia.
Posts: 1569
Joined: Sun Mar 04, 2012 12:49 am
by DexOS » Fri Jun 22, 2012 12:59 pm
pygmy_giant wrote:Cool - can Joe Public get this?

If you mean, can Joe Public download a kernel.img and config.txt to test it sure, if anyone wants to test it, i can upload it to my site (read below).
But as it does nothing much yet, other than set display mode, display image and print to screen and turn led on/off.
I was waiting for it to be ably to do more, like interact with users.
Which i hope to get working in the coming days.

If you mean will the code be available then yes, but not until OS is use able too.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by gillespie » Sun Jun 24, 2012 7:09 pm
DexOS wrote:
pygmy_giant wrote:Cool - can Joe Public get this?

If you mean, can Joe Public download a kernel.img and config.txt to test it sure, if anyone wants to test it, i can upload it to my site (read below).


I'd love to test it if possible, I assume your site is http://www.dex-os.com, but I couldn't find it on there

Thanks
Posts: 4
Joined: Fri Jun 15, 2012 12:58 am
by pygmy_giant » Mon Jun 25, 2012 11:20 am
I class myself more of a nooby end user than developer but would help where I can with testing - I look forward to future release at your convenience.
Ostendo ignarus addo scientia.
Posts: 1569
Joined: Sun Mar 04, 2012 12:49 am
by DexOS » Mon Jun 25, 2012 2:26 pm
Here is the files if anyone wants to test
http://www.dex-os.com/DexOS_R_PI/DexOS_R_PI.zip

To test, just format a SD card to fat32 and add all the files in the "Put on SD card" folder, that's in the zip file.
Then just startup your raspberry pi with the SD card in.
Simple ;) .

Note: i have only tested with 2 GB SD card.
Any ?, just ask.
And thanks for testing.
Dex.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by pygmy_giant » Mon Jun 25, 2012 6:48 pm
Did as you said and got what you described - it set the display mode, correctly displayed an image on my Sharp 1024 x 768 monitor, printed to the screen (via an HDMI - > DVI adapter) and turned the led on/off. It booted in the blink of an eye and worked first time - my testing is successfully completed.

I did not waste an age 'burning' an 'image' to my SD card - I just copied the files from my windows PC! Legend has it that God handed moses the 10 commandments on the (50x 2gb Kingston elite) SD card that I used. This card was manufactured before the classification system was implimented, so I cannot tell you what 'class' it is - just that it is shaped like an SD card and behaves accordingly.

Good work :P
Ostendo ignarus addo scientia.
Posts: 1569
Joined: Sun Mar 04, 2012 12:49 am
by DexOS » Mon Jun 25, 2012 8:02 pm
pygmy_giant wrote:Did as you said and got what you described - it set the display mode, correctly displayed an image on my Sharp 1024 x 768 monitor, printed to the screen (via an HDMI - > DVI adapter) and turned the led on/off. It booted in the blink of an eye and worked first time - my testing is successfully completed.

I did not waste an age 'burning' an 'image' to my SD card - I just copied the files from my windows PC! Legend has it that God handed moses the 10 commandments on the (50x 2gb Kingston elite) SD card that I used. This card was manufactured before the classification system was implimented, so I cannot tell you what 'class' it is - just that it is shaped like an SD card and behaves accordingly.

Good work :P

Cool thanks for testing, hope to get a new image out soon with more functions.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by tufty » Mon Jun 25, 2012 9:29 pm
I wouldn't bother with the "encryption" stage next time. If someone can be bothered to fold your binary into something that can be disassembled, anything you can do is broken before you bother to start

It took me 2 minutes, but that's largely because I'm typing on a french keyboard but using an english keymap ;)

Hint :

Code: Select all
$ irb
>> out =File.new "dex.img","w+"
=> #<File:dex.img>
>> i = 0
=> 0
>> File.new("kernel.img").each_byte do |b|
?> if i < 0x803c|| i > 0x803c + 0x1494
>> out.putc b
>> else
?> out.putc b ^ 0xaa
>> end
>> i = i + 1
>> end
=> #<File:kernel.img>
>> out.close
=> nil
>> ^D
$ touch foo.c
$ arm-none-eabi-gcc -c foo.c -o foo
$ arm-none-eabi-objcopy --add-section dex=dex.img foo
$ arm-none-eabi-objdump -D foo | less

Oh, yeah, works here too. Nice one

Simon
Posts: 1364
Joined: Sun Sep 11, 2011 2:32 pm
by DexOS » Tue Jun 26, 2012 2:09 am
tufty wrote:I wouldn't bother with the "encryption" stage next time. If someone can be bothered to fold your binary into something that can be disassembled, anything you can do is broken before you bother to start

It took me 2 minutes, but that's largely because I'm typing on a french keyboard but using an english keymap ;)

Hint :

Code: Select all
$ irb
>> out =File.new "dex.img","w+"
=> #<File:dex.img>
>> i = 0
=> 0
>> File.new("kernel.img").each_byte do |b|
?> if i < 0x803c|| i > 0x803c + 0x1494
>> out.putc b
>> else
?> out.putc b ^ 0xaa
>> end
>> i = i + 1
>> end
=> #<File:kernel.img>
>> out.close
=> nil
>> ^D
$ touch foo.c
$ arm-none-eabi-gcc -c foo.c -o foo
$ arm-none-eabi-objcopy --add-section dex=dex.img foo
$ arm-none-eabi-objdump -D foo | less

Oh, yeah, works here too. Nice one

Simon

Thanks tufty for testing.
And the simple xor did its job, not to stop, but to see who would want to disassemble it ;) .
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by tufty » Tue Jun 26, 2012 6:51 am
Critique time

I'd probably think about changing your function pre/postambles, you're wasting a word on every function.

Rather than this
Code: Select all
mov rX, lr
...
mov lr, rX
mov pc, lr

you'd probably be better off using something like this
Code: Select all
push {rX-rY,lr}
...
pop {rX-rY, pc}

(or do the same using stmdb/ldmia, but push and pop are easier to read)

This not only saves you a word (which you could save in your postamble by simply moving rX to the pc), but also enables you to save any regs that might get smashed 'for free'. For a function that doesn't call any others, and doesn't smash any regs you care about (your wait routine springs to mind, all you have to do is move the loop counter to a 'smashable' register), I wouldn't even bother saving the link register, instead just exit with a simple
Code: Select all
bx lr
Posts: 1364
Joined: Sun Sep 11, 2011 2:32 pm
by walney » Tue Jun 26, 2012 4:29 pm
DexOS wrote:
toxibunny wrote:Image

google 'sd slot extender' :)

Thanks, As these look ideal, but i can not find a UK suppler.

Found 1 or 2 on ebay (but not cheap at £10+)
http://www.ebay.co.uk/itm/SD-card-extension-Cable-/110903317130?pt=UK_Photography_MemoryCardReaders_RL&hash=item19d25a528a
User avatar
Posts: 233
Joined: Wed Nov 30, 2011 6:57 pm
by DexOS » Tue Jun 26, 2012 5:02 pm
walney wrote:
DexOS wrote:
toxibunny wrote:Image

google 'sd slot extender' :)

Thanks, As these look ideal, but i can not find a UK suppler.

Found 1 or 2 on ebay (but not cheap at £10+)
http://www.ebay.co.uk/itm/SD-card-extension-Cable-/110903317130?pt=UK_Photography_MemoryCardReaders_RL&hash=item19d25a528a

Thanks walney, i will get one, i seen them at £35, so the price is OK.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by pygmy_giant » Wed Jun 27, 2012 6:52 pm
Hi Dex - some people like me who are interested in robotics/automation just want to access the GPIO pins and are not bothered about mouse/keyboard/display/usb (although an I2C / SPI driver would be useful). Could this be easily achieved by adapting your demo using a binary compiled from c libraries? I guess what I'm after is just a launch pad to boot straight into some compiled code with I2C / GPIO support.

For projects like a balancing robot or autonomous helicopter/drone less-is more as real-time control is critical.

Do you know how this could be done?
Ostendo ignarus addo scientia.
Posts: 1569
Joined: Sun Mar 04, 2012 12:49 am
by DexOS » Wed Jun 27, 2012 7:55 pm
pygmy_giant wrote:Hi Dex - some people like me who are interested in robotics/automation just want to access the GPIO pins and are not bothered about mouse/keyboard/display/usb (although an I2C / SPI driver would be useful). Could this be easily achieved by adapting your demo using a binary compiled from c libraries? I guess what I'm after is just a launch pad to boot straight into some compiled code with I2C / GPIO support.

For projects like a balancing robot or autonomous helicopter/drone less-is more as real-time control is critical.

Do you know how this could be done?

You can take a look at the work of dwelch67
https://github.com/dwelch67/raspberrypi
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by jbeale » Wed Jun 27, 2012 8:30 pm
I don't have my Pi yet (hopefully soon). Just wanted to say great work so far on the "bare bones" approach, and I'm looking forward to being able to use this code! I'd like to be able to do some realtime stuff without too much extra overhead.

Edit: the github stuff from dwelch67 is very informative; he has some good info in the README files there.
User avatar
Posts: 1976
Joined: Tue Nov 22, 2011 11:51 pm
by DexOS » Thu Jun 28, 2012 1:28 pm
jbeale wrote:I don't have my Pi yet (hopefully soon). Just wanted to say great work so far on the "bare bones" approach, and I'm looking forward to being able to use this code! I'd like to be able to do some realtime stuff without too much extra overhead.

Edit: the github stuff from dwelch67 is very informative; he has some good info in the README files there.


Thanks jbeale, i hope you find it useful.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by gillespie » Fri Jun 29, 2012 4:27 pm
So as far as I can tell, the pi seems to ignore whatever values you pass it in the FB struct (e.g. for width/height) and just use the values from config.txt. Is this what's supposed to happen, or am I doing something wrong? I've not tried the linux framebuffer driver, but I assume that can switch modes on the fly, so it must be possible.
Posts: 4
Joined: Fri Jun 15, 2012 12:58 am
by DexOS » Fri Jun 29, 2012 7:17 pm
gillespie wrote:So as far as I can tell, the pi seems to ignore whatever values you pass it in the FB struct (e.g. for width/height) and just use the values from config.txt. Is this what's supposed to happen, or am I doing something wrong? I've not tried the linux framebuffer driver, but I assume that can switch modes on the fly, so it must be possible.


It should not ignore the values pass to FB struct and yes you can switch modes on the fly, has the above demo does.
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm
by gillespie » Sun Jul 01, 2012 9:54 am
DexOS wrote:
gillespie wrote:So as far as I can tell, the pi seems to ignore whatever values you pass it in the FB struct (e.g. for width/height) and just use the values from config.txt. Is this what's supposed to happen, or am I doing something wrong? I've not tried the linux framebuffer driver, but I assume that can switch modes on the fly, so it must be possible.


It should not ignore the values pass to FB struct and yes you can switch modes on the fly, has the above demo does.


Yeah sorry, it was just me being an idiot and using the wrong bit of memory... all is well now, thanks
Posts: 4
Joined: Fri Jun 15, 2012 12:58 am
by DexOS » Wed Jul 04, 2012 8:53 pm
A cool fractal demo by krom.
Running bare metal on Raspberry Pi.
Using FasmArm of cause.
Image
Batteries not included, Some assembly required.
User avatar
Posts: 860
Joined: Wed May 16, 2012 6:32 pm