Go to advanced search

by jamesmintram
Mon Oct 22, 2018 1:10 pm
Forum: Bare metal, Assembly language
Topic: Shutting Down QEMU
Replies: 1
Views: 1662

Re: Shutting Down QEMU

You can use the smihosting API. This is what I have:

Code: Select all

exit:
  mov w0, 0x18
  mov x1, #0x20000
  add x1, x1, #0x26
  hlt #0xF000
Then run Qemu like this:

Code: Select all

qemu-system-aarch64 -M raspi3 -semihosting -kernel build/kernel.bin
And it works for me
by jamesmintram
Sun Sep 30, 2018 7:30 pm
Forum: Bare metal, Assembly language
Topic: UART and Caching
Replies: 4
Views: 2881

Re: UART and Caching

Boom.. worked first time!

Thanks :)
by jamesmintram
Sun Sep 30, 2018 5:45 pm
Forum: Bare metal, Assembly language
Topic: UART and Caching
Replies: 4
Views: 2881

Re: UART and Caching

Ah yes, that makes perfect sense. Easy to forget that the Mailbox is an "external" device. Just a thought... I wonder if you set your memory flags to outer shareable and the cache to Write Through - whether that would work without cache cleaning? (Ensuring correct use of memory barriers).. Anyway, I...
by jamesmintram
Sun Sep 30, 2018 3:57 pm
Forum: Bare metal, Assembly language
Topic: UART and Caching
Replies: 4
Views: 2881

UART and Caching

So, today I have enabled the cache and what I receive over UART when testing on device is garbage. UART works fine when caching is disabled Everything works - even with caching enabled - when running in Qemu The only thing that appears to go wrong when running it on a Pi3 with caching enabled is my ...
by jamesmintram
Fri Sep 28, 2018 11:34 pm
Forum: Bare metal, Assembly language
Topic: JTag for Raspberry Pi 3
Replies: 2
Views: 1157

Re: JTag for Raspberry Pi 3

OK, so in the end I got one of these: https://www.mouser.co.uk/new/segger/seggerjlink/ Using it with openocd and it works great! I got most of my info from here: https://www.suse.com/c/debugging-raspberry-pi-3-with-jtag/ One thing that caught me out, when recompiling openocd - check the output from ...
by jamesmintram
Fri Sep 28, 2018 11:06 am
Forum: Bare metal, Assembly language
Topic: Idea: Using Supervisor mode for Bootloader
Replies: 4
Views: 1120

Idea: Using Supervisor mode for Bootloader

Something I have been thinking about recently. I have seen a few bootloaders out there that let you load an image over UART (for example) - and that is great for iteration. However you have to power cycle your device, now this could be me being ultra lazy.. but I was thinking it would be nice if I h...
by jamesmintram
Thu Sep 27, 2018 10:29 am
Forum: Bare metal, Assembly language
Topic: JTag for Raspberry Pi 3
Replies: 2
Views: 1157

JTag for Raspberry Pi 3

I have found this: https://github.com/daniel-k/rpi3-aarch64-jtag Which (seems) to reference this: https://www.olimex.com/Products/ARM/JTAG/ARM-USB-OCD/ Can anyone confirm (or deny!) that this olimex product will work with Pi3B+? (For running and debugging a 64bit bare metal program) or - does anyone...
by jamesmintram
Thu Sep 27, 2018 7:14 am
Forum: Bare metal, Assembly language
Topic: Building a network stack
Replies: 12
Views: 1760

Re: Building a network stack

Hey dwelch67, Thanks for all that info! ARP and ping will be your first test to get your feet wet Sounds like ARP and Ping are similar to rendering your first trianglewhen building a graphics engine! tcp/ip illustrated volume 1 This is on my list to purcahse, also I already have Tanenbaum. Those cou...
by jamesmintram
Wed Sep 26, 2018 8:02 pm
Forum: Bare metal, Assembly language
Topic: Building a network stack
Replies: 12
Views: 1760

Re: Building a network stack

Hi rst, thanks for that, there is some really good information there. My experience is, doing this from scratch is not that easy and it takes time, but you can learn a lot from it about USB 2.0 and TCP/IP. I actually meant I will be ready to start working on the USB/Network stack in a month or two. ...
by jamesmintram
Wed Sep 26, 2018 7:06 pm
Forum: Bare metal, Assembly language
Topic: Building a network stack
Replies: 12
Views: 1760

Re: Building a network stack

Thanks ronyoung1 - that looks really great!

I am looking forward to working on this :)
by jamesmintram
Wed Sep 26, 2018 4:27 pm
Forum: Bare metal, Assembly language
Topic: Building a network stack
Replies: 12
Views: 1760

Re: Building a network stack

Shame about the documentation not being available :(

Those resources are really great though, small enough to easily get the big picture.

Thanks
by jamesmintram
Wed Sep 26, 2018 12:58 pm
Forum: Bare metal, Assembly language
Topic: Building a network stack
Replies: 12
Views: 1760

Re: Building a network stack

Thanks, that is exactly what I was looking for. I am working with a Pi 3B+ - I am guessing this is the doc I need for the ethernet controller: http://ww1.microchip.com/downloads/en/DeviceDoc/00001992F.pdf I was looking for the documentation for the USB controller and ended up at Synopsys' website (f...
by jamesmintram
Wed Sep 26, 2018 10:49 am
Forum: Bare metal, Assembly language
Topic: Building a network stack
Replies: 12
Views: 1760

Building a network stack

This is something I may be looking at in a month or 2 and was wondering if anyone else has done so and what pain points they had? Assume I am working with a simple OS which handles memory, scheduling, etc. Do I need a working USB stack before I can do anything with the ethernet controller? If so, ca...
by jamesmintram
Tue Sep 11, 2018 11:39 am
Forum: Bare metal, Assembly language
Topic: Reasons behind MMIO base address
Replies: 3
Views: 962

Re: Reasons behind MMIO base address

What we have learned from snippets of information provided over the years is that the VC4 GPU only supports a 1GB address space (which is the reason why the Pi cannot have more than 1GB) and because the GPU needs access to the peripherals they need to fall within that 1GB range. Ah, that makes sens...
by jamesmintram
Sun Sep 09, 2018 9:12 pm
Forum: Bare metal, Assembly language
Topic: Reasons behind MMIO base address
Replies: 3
Views: 962

Reasons behind MMIO base address

The Pi 2 and 3 have 1024MB of memory from 0x00000000 to 0x3EFFFFFF and use the last 16MB for memory mapped IO (0x3F000000 - 0x3FFFFFFF)

I am curious as to why they didn't just start the MMIO at 0x40000000?

Does anyone know?
by jamesmintram
Fri Jan 26, 2018 4:06 pm
Forum: Bare metal, Assembly language
Topic: Mini UART dropping data
Replies: 4
Views: 803

Re: Mini UART dropping data

Hey, Thanks for that link, interesting! I haven't tried UART0 yet - I didn't think there would be *that* much difference.. but I know almost nothing about hardware :) I guess the thing that surprised me was not being able to get more than a few bytes across before stuff is dropped. I couldn't get mo...
by jamesmintram
Thu Jan 25, 2018 10:04 pm
Forum: Bare metal, Assembly language
Topic: Mini UART dropping data
Replies: 4
Views: 803

Mini UART dropping data

Hey Guys, Another question from me! For background, I am (attempting) to write a simple bootloader that will load code over the mini UART (similar to dwelch67's bootloader) Is there any general advice/pointers as to managing overflows of the UART's FIFO? Initially I was under the impression control ...
by jamesmintram
Tue Jan 23, 2018 5:59 pm
Forum: Bare metal, Assembly language
Topic: Base memory address 0x80000
Replies: 7
Views: 939

Re: Base memory address 0x80000

aaaand it's solved. For anyone interested: Kernel is loaded (by default) into 0x80000 in AARCH64 (different from AARCH32 where it is 0x8000) The linker script I was using used was originally this: SECTIONS { .text : { KEEP (*(.traps)) . = 0x8000; /* Space for command line. */ *(.text .text.* .gnu.li...
by jamesmintram
Tue Jan 23, 2018 5:37 pm
Forum: Bare metal, Assembly language
Topic: Base memory address 0x80000
Replies: 7
Views: 939

Re: Base memory address 0x80000

I used tutorial 03_uart1 from bztsrc and modified it slightly: void func_1() { uart_puts("FUNC1\n"); } void func_2() { uart_puts("FUNC2\n"); } typedef void(*fn_ptr)(); void main() { // set up serial console uart_init(); fn_ptr ptrs[2] = {func_1, func_2}; int idx = *((unsigned char*)0x88930) % 2; ptr...
by jamesmintram
Tue Jan 23, 2018 5:23 pm
Forum: Bare metal, Assembly language
Topic: Base memory address 0x80000
Replies: 7
Views: 939

Re: Base memory address 0x80000

So I wrote and ran that test I mentioned: let fns = [flash_slow_loop, flash_fast_loop]; fns[0](); This simply stores two function pointers at indices 0 and 1. Then calls the function at 0. .... and it hangs! So there is something definitely wrong with my toolchain configuration. I just don't know wh...
by jamesmintram
Tue Jan 23, 2018 2:21 pm
Forum: Bare metal, Assembly language
Topic: Base memory address 0x80000
Replies: 7
Views: 939

Re: Base memory address 0x80000

3992 and 4008 are 16 bytes apart the functions are over 400 bytes apart They are, but these are not the function pointers themselves, but instead the memory location where the function pointers are found. So: At 3992 you will find: 0000000000008858 and at 4008 you will find: 0000000000008a1c Which ...
by jamesmintram
Tue Jan 23, 2018 10:38 am
Forum: Bare metal, Assembly language
Topic: Base memory address 0x80000
Replies: 7
Views: 939

Re: Base memory address 0x80000

Hey, thanks. Interesting thought, unfortunately doesn't seem to be the problem. fn _init_thread(new_thread: *mut Thread, trampoline: extern fn() -> ()); Is the extern prototype for the ASM routine. The second parameter is equivalent to: void(*trampoline)(void) In C, which where sizeof would return 8...
by jamesmintram
Mon Jan 22, 2018 5:46 pm
Forum: Bare metal, Assembly language
Topic: Base memory address 0x80000
Replies: 7
Views: 939

Base memory address 0x80000

Hey guys, I have another question. I am passing a C function pointer to an assembly routine (from Rust) however the value of the function pointer is missing the high part of the address (0x80000) Example of what I see when calling the routine: Address in x30 register: 0x88730 Address of function poi...
by jamesmintram
Thu Jan 18, 2018 3:23 pm
Forum: Bare metal, Assembly language
Topic: Yet Another Bare Metal Tutorial for the RPi3
Replies: 74
Views: 42027

Re: Yet Another Bare Metal Tutorial for the RPi3

Hey, thanks!

Yes, I was reading the documentation on their website. There is a lot of it!

Thanks for pointing me in the right direction.

Go to advanced search