Go to advanced search

by hldswrth
Wed Aug 28, 2013 11:35 am
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5835

Re: 64 bit integers

What result do you get? Do you need to suffix LL on that constant for it to work? Also standard printf format syntax would require "%llX" rather than "%X" but that's probably not your issue. One thing you might try with your test function is adding an extra int or char* parameter in front of the lon...
by hldswrth
Wed Aug 28, 2013 12:23 am
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5835

Re: 64 bit integers

Shouldn't that be temp = (value >> 32); if its supposed to be holding the top 32 bits? You're shifting the wrong way. Also you show a test function but don't explain how you get to it. Are you just loading SP with x8000 then branching there? What C compile flags are you using? I have: CCOPT = -Wall ...
by hldswrth
Mon Aug 26, 2013 9:55 am
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5835

Re: 64 bit integers

Its not just where you start the stack, you have to make sure every stack push/pop does a multiple of 8 bytes. My solution was to make sure that whereever I push registers in bits of assembly that I do it in an even number. If you have a push somewhere between your kernel start point and calling C c...
by hldswrth
Sun Aug 25, 2013 2:30 pm
Forum: Bare metal, Assembly language
Topic: 64 bit integers
Replies: 22
Views: 5835

Re: 64 bit integers

The ARM has no built-in integer division capability. If you do divides in your code you're likely to hit unresolved reference errors for the following functions: void __aeabi_uldivmod(unsigned long long numerator, unsigned long long denominator) void __aeabi_idivmod(int numerator, int denominator) v...
by hldswrth
Sat Jul 27, 2013 12:56 pm
Forum: General discussion
Topic: Serial communiacation
Replies: 10
Views: 3040

Re: Serial communiacation

I've used serial comms in bare metal to implement basic file transfer using ymodem. I've not seen any synchronization issues or line errors unless I set different baud rates at each end. The code that sets the baud rate on my Pi is as follows. I tend to use 115200 or 921600 with no issues. volatile ...
by hldswrth
Mon Jul 08, 2013 8:45 am
Forum: Bare metal, Assembly language
Topic: chess in assembly!
Replies: 36
Views: 15739

Re: chess in assembly!

Indeed I do - check out http://www.zx81stuff.org.uk/zx81/genera ... ic%29.html
You can play the game in browser; to make a move type the coordinates of the piece and target coordinates, e.g. 7D5D.
by hldswrth
Fri Jul 05, 2013 11:55 am
Forum: General discussion
Topic: Minimum peripherals to run a PI
Replies: 6
Views: 1052

Re: Minimum peripherals to run a PI

The pi does have an internal clock (or at least, an internal counter) its just not battery-backed, so it has no concept of the current time on its own. Once the time has been set manually or via a network connection the Pi can maintain the current time, however you're right, if the Pi is rebooted wi...
by hldswrth
Mon Jun 24, 2013 1:48 pm
Forum: Bare metal, Assembly language
Topic: Mouse Input?
Replies: 14
Views: 5409

Re: Mouse Input?

What I continually struggle with here, both for SD card access and now USB, is that all the information is provided as raw reference for registers, e.g. bit 7 at address $7c004567 means use 4-bit instead of 1. What seems to be completely missing is any description of the protocol even at a very simp...
by hldswrth
Wed Apr 24, 2013 3:49 pm
Forum: Bare metal, Assembly language
Topic: OS with executable/application support?
Replies: 6
Views: 2335

Re: OS with executable/application support?

Ok I think the concept I was looking for was dynamic loading. Can I get an overview of how this works? Or is there any material on this subject for someone who has no knowledge in the matter? I decided to use ELF for this, here's a URL: http://wiki.osdev.org/ELF I used this document as my main refe...
by hldswrth
Wed Apr 24, 2013 12:50 pm
Forum: Bare metal, Assembly language
Topic: OS with executable/application support?
Replies: 6
Views: 2335

Re: OS with executable/application support?

This is something I've been working on in my bare metal project. My aim was to provide a command line environment from which you could run programs off the SD card, with the programs written in C against a subset of the standard C library (stdio in particular). To get to that I needed (and currently...
by hldswrth
Thu Mar 14, 2013 9:38 am
Forum: Bare metal, Assembly language
Topic: Question on compiling custom kernel
Replies: 3
Views: 1275

Re: Question on compiling custom kernel

Seems a common misunderstanding that the "boot" files do NOT go in a "boot" directory, they go in the root directory of the SD card. I made the same mistake myself when I started out. (although re-reading your post I'm not sure that you're actually doing that). The next most common issues are to do ...
by hldswrth
Wed Feb 27, 2013 5:42 pm
Forum: Bare metal, Assembly language
Topic: Std libs with arm-eabi-gcc
Replies: 21
Views: 9880

Re: Std libs with arm-eabi-gcc

FYI from C code: /* Copy memory from the source to destination. */ void* memcpy( void* dest, const void* source, size_t num ) { unsigned char* d = dest; const unsigned char* s = source; while( num-- > 0 ) *d++ = *s++; return dest; } I get: 00000100 <memcpy>: 100: e3520000 cmp r2, #0 104: e92d00f0 pu...
by hldswrth
Tue Feb 26, 2013 12:53 pm
Forum: Bare metal, Assembly language
Topic: Std libs with arm-eabi-gcc
Replies: 21
Views: 9880

Re: Std libs with arm-eabi-gcc

Just a comment on optimisation of things like memcpy. The code you posted: void memcpy ( unsigned char *d, unsigned char *s, unsigned len ) { while(--len) *d++ = *s++; } When compiled with gcc with an indication of the target processor (i forget the exact flag) and high optimisation, does exactly wh...
by hldswrth
Wed Feb 20, 2013 1:49 pm
Forum: Bare metal, Assembly language
Topic: SD card insert/remove detection?
Replies: 4
Views: 3045

Re: SD card insert/remove detection?

You could then also check CID to see if the card is the same card or different card . If you keep a copy of the CID info. I did think about that, however my concern would be that just because its the same card does not mean the contents are necessarily the same. The question is whether any open fil...
by hldswrth
Wed Feb 20, 2013 12:57 am
Forum: Bare metal, Assembly language
Topic: SD card insert/remove detection?
Replies: 4
Views: 3045

Re: SD card insert/remove detection?

OK, so to answer my own question a bit more research indicates that the SD card's interrupt and status registers were the wrong place to look, and GPIO 47 is the right place. By setting the GPIO high detect enable register (GPHEN1) bit for GPIO 47, I can then check the GPIO event detect status regis...
by hldswrth
Tue Feb 19, 2013 11:27 pm
Forum: Bare metal, Assembly language
Topic: SD card insert/remove detection?
Replies: 4
Views: 3045

SD card insert/remove detection?

I've been looking at how to detect hot insert/remove of SD cards so my fledgling OS can handle the same or different card being swapped. As far as I can see there's nothing documented for this in the Broadcom docs. Best I could find in other SD card host documentation was that there's expected to be...
by hldswrth
Thu Feb 14, 2013 9:39 am
Forum: Bare metal, Assembly language
Topic: Writing a basic hello world OS?
Replies: 12
Views: 7671

Re: Writing a basic hello world OS?

I use yagarto as the compiler and Eclipse as the development environment. There's a good guide to setting that up here: http://www.yagarto.de/howto/yagarto2/index.html So far I've not set up remote debugging so I skipped those bits. I find Eclipse very helpful in terms of navigating around code, che...
by hldswrth
Mon Feb 11, 2013 11:30 am
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 5176

Re: SD card second write produces timeout

I'm more than happy to answer questions about what I did and post snippets, however my employer owns the IP to all code I write. I would need management approval to make any fully working code available, and that would be under a specific license. That's not really something I want to go through at ...
by hldswrth
Thu Feb 07, 2013 12:25 pm
Forum: Bare metal, Assembly language
Topic: SD card second write produces timeout
Replies: 20
Views: 5176

Re: SD card second write produces timeout

I've not published my code, not yet sure where I want to go with it. I'm actually 80% of the way through a basic FAT file system implementation, and need to improve some aspects of the SD card access once that's done as I suspect I have some hard-coded values which may break the code on other cards....
by hldswrth
Thu Feb 07, 2013 12:21 pm
Forum: Bare metal, Assembly language
Topic: Using DMA for a FillBlt
Replies: 4
Views: 1745

Re: Using DMA for a FillBlt

I've yet to get to driving DMA for screen updates, although I wanted to see the effect it would have on my console scrolling which feels a little slow at the moment. From what I understand the memory read might be 32 or 128 bits, but the write should only write the number of bytes specified, it shou...
by hldswrth
Thu Jan 17, 2013 1:18 pm
Forum: Bare metal, Assembly language
Topic: SD driver problems
Replies: 22
Views: 4707

Re: SD driver problems

I just got it from experimentation - I dumped out the content of the 4 registers as hex and ASCII and observed that some meaningful text appeared one character offset from where I expected it. Plus the fact that the CRCs are not exposed through the registers in non-SPI mode (and I never got SPI mode...
by hldswrth
Tue Jan 15, 2013 1:24 pm
Forum: Bare metal, Assembly language
Topic: SD driver problems
Replies: 22
Views: 4707

Re: SD driver problems

Here's my code to parse the CID from RESP registers: Basically everything is 8 bits lower than expected because there is no CRC byte included at the end. int cid[4]; cid[0] = *EMMC_RESP3; // 0x2030001c cid[1] = *EMMC_RESP2; // 0x20300018 cid[2] = *EMMC_RESP1; // 0x20300014 cid[3] = *EMMC_RESP0; // 0...
by hldswrth
Thu Jan 10, 2013 9:44 am
Forum: Bare metal, Assembly language
Topic: SD driver problems
Replies: 22
Views: 4707

Re: SD driver problems

As far as I remember the information in the four registers was 8 bits shifted from where I expected it to be. Unfortunately I don't have my code in front of me right now to show it, will post later.
by hldswrth
Thu Nov 29, 2012 3:14 pm
Forum: Bare metal, Assembly language
Topic: start.elf - what's really needed for bare metal OS?
Replies: 5
Views: 9856

Re: start.elf - what's really needed for bare metal OS?

> You can delete start.elf (and fixup.dat) if you set gpu_mem=16 in config.txt. > It uses start_cd.elf which is 550K and doesn't include support for GL/VG/OpenMAX etc. I don't have fixup.dat or start_cd.elf. All I have is: bootcode.bin, loader.bin, start.elf, config.txt and my kernel.img. > The 2MB ...
by hldswrth
Thu Nov 29, 2012 1:53 pm
Forum: Bare metal, Assembly language
Topic: start.elf - what's really needed for bare metal OS?
Replies: 5
Views: 9856

start.elf - what's really needed for bare metal OS?

So I'm making progress, coding my bare metal OS, file system, shell, c runtime, even got a port of NetHack working... and all of that in about 150k (barring NetHack, which compiles to 2Mb). So now I'm looking at start.elf and wondering why I need 2Mb to flash the screen in pretty colours for about 1...

Go to advanced search