Go to advanced search

by LdB
Fri Sep 13, 2019 10:44 am
Forum: Bare metal, Assembly language
Topic: RPi 4 Working Mailbox example
Replies: 17
Views: 641

Re: RPi 4 Working Mailbox example

Okay thank you for that simplifying now can see it better Ok this fails for 2 reasons void* mmappedData = mmap( NULL, BLOCK_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, block->mem_fd, MAILBOX_BASE ); Somehow we both forgot the 0x200000 offset from Peripheral base To GPIO base #define MAILBOX_BASE 0xFE200...
by LdB
Fri Sep 13, 2019 3:10 am
Forum: Bare metal, Assembly language
Topic: RPi 4 Working Mailbox example
Replies: 17
Views: 641

Re: RPi 4 Working Mailbox example

Sorry if it came across wrong there was no sarcasm intended I was struggling to understand what you were doing with the pointers.

Yes I am ESL, sorry I cant help where I was born.

All I can offer is to put a sample version out on github and you can try and work out what I did.
by LdB
Thu Sep 12, 2019 10:49 pm
Forum: Bare metal, Assembly language
Topic: RPi 4 Working Mailbox example
Replies: 17
Views: 641

Re: RPi 4 Working Mailbox example

The thing you are calling "block->map" is the mailbox address under linux .. that is the thing you want and the only thing you need. So trying to follow your original code it goes round in circles. Your code above is correct but I have these two points 1.) My confusion is you have block->map as a vo...
by LdB
Thu Sep 12, 2019 11:46 am
Forum: Bare metal, Assembly language
Topic: [pi4] initramfs mapped incorrectly?
Replies: 5
Views: 142

Re: [pi4] initramfs mapped incorrectly?

So you understand how the Pi starts and you semi answered your own question You have 2 choices 1.) Bind all the kernel images into one big kernel image (the VC6 will then load it for you excatly as you described) . The FAT32 loader in the VC4/VC6 is not exposed you can't get access to it from the AR...
by LdB
Thu Sep 12, 2019 4:16 am
Forum: Bare metal, Assembly language
Topic: RPi 4 Working Mailbox example
Replies: 17
Views: 641

Re: RPi 4 Working Mailbox example

You lost me with this you want a pointer to the -mapped space // Otherwise we have a pointer to the mapped space block->addr = (volatile unsigned int *)block->map; You have to access the area via the map address not it's real address .. linux demands it Okay so you have a definition of the mailbox s...
by LdB
Thu Sep 12, 2019 12:40 am
Forum: Bare metal, Assembly language
Topic: [pi4] initramfs mapped incorrectly?
Replies: 5
Views: 142

Re: [pi4] initramfs mapped incorrectly?

I am scratching my head, initramfs is a linux construct AFAIK it's just an area in memory address range allocated for linux to do it's thing with it's kernel. In baremetal all that linux stuff is irrelevant, the memory is whatever you decide and there won't be anything other than junk in it. When we...
by LdB
Tue Sep 10, 2019 1:16 am
Forum: Bare metal, Assembly language
Topic: RPi 4 Working Mailbox example
Replies: 17
Views: 641

Re: RPi 4 Working Mailbox example

No you have not understood. I will try and slice and dice so code on the fly here so there may be some errors but the general thrust is correct. So this is the mailbox structure in code form (it is correct I have cut and paste it from working code) struct MailBoxRegisters { const uint32_t Read0; // ...
by LdB
Mon Sep 09, 2019 2:37 pm
Forum: Bare metal, Assembly language
Topic: Detecting RPi4 programatically
Replies: 8
Views: 290

Re: Detecting RPi4 programatically

It will tell you model/version details etc but you can't get what mode the CPU is currently running in from it or launched with.

In baremetal just make a global flag default is clear ... set it if you enter in AARCh64 .. problem solved.
by LdB
Mon Sep 09, 2019 2:25 pm
Forum: Bare metal, Assembly language
Topic: Detecting RPi4 programatically
Replies: 8
Views: 290

Re: Detecting RPi4 programatically

He has to be talking about Linux because in true baremetal there is no way in hell you don't know what mode your in ... the Start address, IRQ table, opcodes and stack setups and EABI are different. You have to compile for all that at startup and if you start in 32 bit mode you are forever stuck in ...
by LdB
Fri Sep 06, 2019 1:08 am
Forum: Bare metal, Assembly language
Topic: Clean, OS-independent Pi programming using C/C++
Replies: 11
Views: 399

Re: Clean, OS-independent Pi programming using C/C++

The generic answer without recommendation is read the two stickies at the top of the post lists and then ask anything specific not covered.

It offers background, references and options and links to those items.
by LdB
Wed Sep 04, 2019 2:29 pm
Forum: Bare metal, Assembly language
Topic: Using my Pi as a cross-compiler
Replies: 4
Views: 190

Re: Using my Pi as a cross-compiler

What you said is correct however there is no requirement for linux at all you can simply cross from windows 10 and put your kernel file on a FAT32 formatted SD card with a couple of other files. The windows version (32 bit) of arm-none-eabi toolchain is available from ARM itself for AARCH32 develope...
by LdB
Wed Sep 04, 2019 2:14 am
Forum: Bare metal, Assembly language
Topic: RPi 4 Working Mailbox example
Replies: 17
Views: 641

Re: RPi 4 Working Mailbox example

Correct
by LdB
Mon Sep 02, 2019 5:49 pm
Forum: Bare metal, Assembly language
Topic: RPi 4 Working Mailbox example
Replies: 17
Views: 641

Re: RPi 4 Working Mailbox example

The code you are showing is baremetal code .. >>>> AKA NOT LINUX <<<<< Under linux you need to first map the peripheral area, you have no access rights :-) Have a quick read of this https://www.pieter-jan.com/node/15 This address in that link is wrong it is Pi 1 (aka the line below is wrong) .. but ...
by LdB
Mon Sep 02, 2019 7:22 am
Forum: Bare metal, Assembly language
Topic: Learn assembly language which is on raspbian with this book
Replies: 4
Views: 327

Re: Learn assembly language which is on raspbian with this book

FYI GCC is installed on all the normal Pi images (even buster lite etc) and it has a dedicated external assembler arm-none-eabi-as as well as doing inline assembler so you don''t have to install anything. I would also highly recommend the online compiler explorer https://godbolt.org/ On the right pa...
by LdB
Fri Aug 30, 2019 6:30 pm
Forum: Bare metal, Assembly language
Topic: what does this code mean?
Replies: 6
Views: 372

Re: what does this code mean?

It is making sure the ARM->VC Mailbox isn't full before it sends .. .So if it's full it's hard looping
It is making sure it waits to clear the VC->ARM response ... So if it's empty it's hard looping.
There is a 8 fifo buffer each way
by LdB
Fri Aug 30, 2019 3:21 am
Forum: Bare metal, Assembly language
Topic: where is the definition of HidUsageAttach for Chadderz121 cusd code?
Replies: 12
Views: 425

Re: where is the definition of HidUsageAttach for Chadderz121 cusd code?

KeyboardAttach is a function the function is at line 86 https://github.com/Chadderz121/csud/blob/master/source/device/hid/keyboard.c The code simply initially zeros all the pointers and then sets the given single index of DesktopKeyboard function pointer to the code at line 86. DesktopKeyboard = 6 i...
by LdB
Fri Aug 30, 2019 2:57 am
Forum: Bare metal, Assembly language
Topic: what does this code mean?
Replies: 6
Views: 372

Re: what does this code mean?

Which btw might not make any sense at this position as this is the mailbox from VC to ARM and it is only full if the GPU/VC has passed data to ARM. On a multicore or threaded code what you said does not hold. Another thread or core may have just loaded the mailbox to full (released a lock if applic...
by LdB
Fri Aug 30, 2019 2:50 am
Forum: Bare metal, Assembly language
Topic: Raspbian assembly draw a line on screen
Replies: 7
Views: 470

Re: Raspbian assembly draw a line on screen

RST he is dealing with assembler code so it fits this area because it is now bare metal & assembler code.

@John convert code to asm and send it to GCC assembler and it will work as is.
by LdB
Wed Aug 28, 2019 3:13 pm
Forum: Raspbian
Topic: Wifi not working on Pi Zero W
Replies: 13
Views: 1373

Re: Wifi not working on Pi Zero W

Check /etc/wpa_supplicant/wpa_supplicant.conf

I had issue wifi would not connect because of keyboard mapping bug on install for Raspbian Buster. You can't see what types for password and it was wrong I only realized it when I saw the password physically in the wpa_supplicant.conf
by LdB
Tue Aug 27, 2019 2:11 pm
Forum: Bare metal, Assembly language
Topic: Raspbian assembly draw a line on screen
Replies: 7
Views: 470

Re: Raspbian assembly draw a line on screen

Can give you the C code for Raw framebuffer under Raspbian Buster Lite (aka Raspbian no desktop known as kiosk mode ) #define _DEFAULT_SOURCE #include <stdbool.h> #include <stdint.h> #include <unistd.h> #include <stdio.h> #include <termios.h> #include <stdlib.h> #include <string.h> #include <math.h>...
by LdB
Tue Aug 27, 2019 3:42 am
Forum: Raspbian
Topic: Raspbian vs Different flavours of linux
Replies: 4
Views: 245

Re: Raspbian vs Different flavours of linux

No the language does not do anything to help!!! You physically are opening some file or device handle and the name of that thing varies along with parameters. It doesn't matter what language you write in unless it obviscates the name and parameters you can't simply port it. Even something simple lik...
by LdB
Tue Aug 27, 2019 2:38 am
Forum: Raspbian
Topic: Raspbian vs Different flavours of linux
Replies: 4
Views: 245

Raspbian vs Different flavours of linux

I am a long time Windows Programmer but just finished my first ever Kiosk style app for linux on Raspbian on the Pi and besides the learning curve I found it weird you have to access things via /dev /sys etc. When I say weird it's not the actual access but that it varies between linux flavours and i...
by LdB
Mon Aug 26, 2019 3:20 pm
Forum: Raspbian
Topic: Buster lite and /dev/gpiomem
Replies: 4
Views: 112

Re: Buster lite and /dev/gpiomem

It sort of looked like that but many of the letters were all graphical. I re-imaged another SDCard and it looks exactly like that and /dev/gpiomem appears. Tried again on the old SDcard and it was still weird but I also noticed it takes about 4 times as long to image so I have thrown it out. Thanks ...

Go to advanced search