Go to advanced search

by LdB
Sun Oct 20, 2019 5:58 pm
Forum: Bare metal, Assembly language
Topic: Aarch64 - "stp q0, q0, [x8, #224]" hangs my Pi3
Replies: 6
Views: 264

Re: Aarch64 - "stp q0, q0, [x8, #224]" hangs my Pi3

Yes but more specifically you have broken the AAPCS64 calling convention somehow AARCH64 makes an absolute requirement that when calling external functions the stack must be 16byte aligned GCC will default -mpreferred-stack-boundary=4 meaning all its stack stuff is 16byte aligned So what are you doi...
by LdB
Fri Oct 18, 2019 5:08 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 545

Re: C's 'printf'

Stop and consider your moaning about a 47 year old strict type-based language and your complaint is that your shouldn't have to know the type :-)

Perhaps take up another language.
by LdB
Fri Oct 18, 2019 4:56 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 545

Re: C's 'printf'

It's C not GWBasic, types are a feature of the language not a problem and if you don't know what type T is then you really shouldn't be programming in C :-)

People aren't being touchy about C ... your argument is stupid.
by LdB
Fri Oct 18, 2019 4:19 pm
Forum: C/C++
Topic: C's 'printf'
Replies: 27
Views: 545

Re: C's 'printf'

I am with Peter O you aren't highlighting a problem ... you are making one up. As others have said the C standard for the function is basically set in stone and we don't care that you want to change it ... never going to happen. The facts are simple 1.) If you don't meet the C standard library speci...
by LdB
Fri Oct 18, 2019 3:55 pm
Forum: Bare metal, Assembly language
Topic: Aarch64 - "stp q0, q0, [x8, #224]" hangs my Pi3
Replies: 6
Views: 264

Re: Aarch64 - "stp q0, q0, [x8, #224]" hangs my Pi3

What value is in x8? It should to be 16 byte aligned.
by LdB
Fri Oct 18, 2019 3:31 am
Forum: Bare metal, Assembly language
Topic: Circle 64Bit Crashing in Constructor
Replies: 7
Views: 225

Re: Circle 64Bit Crashing in Constructor

I stand to be corrected but if my memory serves me right -mno-unaligned-access does not exist on AARCH64
by LdB
Thu Oct 17, 2019 5:12 am
Forum: Bare metal, Assembly language
Topic: Circle 64Bit Crashing in Constructor
Replies: 7
Views: 225

Re: Circle 64Bit Crashing in Constructor

I did pull a slight of hand when I gave you the flags These flags stop FPU register use for vectorization -fno-tree-loop-vectorize -fno-tree-slp-vectorize You either need to look at the task switcher code or ask rst about fpu use on context switches. So probably play and work out which flag makes th...
by LdB
Thu Oct 17, 2019 1:12 am
Forum: C/C++
Topic: Best way to wait on an event
Replies: 17
Views: 418

Re: Best way to wait on an event

You basically have a render loop and all your draws go to a render buffer and then you put the render to screen. So your responsiveness and operations are set around that loop and its quite normal in games. This UI is for a very different commercial thing and is based around lots of bitmaps and lots...
by LdB
Wed Oct 16, 2019 4:58 pm
Forum: C/C++
Topic: Best way to wait on an event
Replies: 17
Views: 418

Re: Best way to wait on an event

Yes I am doing the same and looking at the linux code and they aren't really following what happens when you sleep a pthread. The real problem is that a sleeping a thread does not release locks and you have no ability to tell it what locks it should release while it sleeps. That is the whole point t...
by LdB
Wed Oct 16, 2019 10:42 am
Forum: Bare metal, Assembly language
Topic: Circle 64Bit Crashing in Constructor
Replies: 7
Views: 225

Re: Circle 64Bit Crashing in Constructor

As you suspect an alignment issue and possibly involving arrays try the compiler flags
-mstrict-align -fno-tree-loop-vectorize -fno-tree-slp-vectorize
by LdB
Wed Oct 16, 2019 10:12 am
Forum: C/C++
Topic: Best way to wait on an event
Replies: 17
Views: 418

Re: Best way to wait on an event

Yes but how would I know how long to sleep the thread for .. its a dumb arse user on the end :-) All you end up doing is sleeping it for some guess time and for low input it's to fast and for fast input it's to slow ... its a horrible hack that just wastes CPU time in the fast case and doesn't give ...
by LdB
Wed Oct 16, 2019 10:04 am
Forum: C/C++
Topic: Best way to wait on an event
Replies: 17
Views: 418

Re: Best way to wait on an event

Yeah sleep and select are out, they are not suitable as I have no idea on how fast or slow events will come thru and so just become crude hacks. Conditional wait looks somewhat similar to WaitOnObjects in Windows which is what I was looking for and looks useful. The only reference I could find which...
by LdB
Wed Oct 16, 2019 9:52 am
Forum: Bare metal, Assembly language
Topic: Aarch64 - how many cores are kicked off in the first place ?
Replies: 4
Views: 181

Re: Aarch64 - how many cores are kicked off in the first place ?

Correct on all counts it works exactly the same as the 32 bit code just different address The ARMSTUBS are installed by the VC4 and run automatically by the ARM cores unless you use kernel_old = 1 in config.txt in which case the VC4 doesn't load them and all the cores enter at 0x0. So write the 64 b...
by LdB
Wed Oct 16, 2019 7:58 am
Forum: C/C++
Topic: Best way to wait on an event
Replies: 17
Views: 418

Best way to wait on an event

This is may be more a linux question but someone may know So I have a custom built kiosk UI (my own code) sitting over a basic linux system using pthreads. I have a touchscreen which I need to pump the messages to the buttons. Basically there is a linked list of buttons and the message is passed dow...
by LdB
Wed Oct 16, 2019 1:59 am
Forum: Bare metal, Assembly language
Topic: Clear bss section before or after setting up the MMU?
Replies: 4
Views: 167

Re: Clear bss section before or after setting up the MMU?

Without hijinx there is always some 1:1 mapping and that area will be where the MMU entry code will be. On the Pi in particular the only reason you wouldn't map all the memory 1:1 is for security. The Pi has a maximum of 4GB and the MMU has many times that for virtualization. There is nothing stoppi...
by LdB
Tue Oct 15, 2019 12:48 pm
Forum: Bare metal, Assembly language
Topic: Aarch64 - how many cores are kicked off in the first place ?
Replies: 4
Views: 181

Re: Aarch64 - how many cores are kicked off in the first place ?

Same in AARCH64 3 cores parked .. the boot stub source is available https://github.com/raspberrypi/tools/blob/master/armstubs/armstub8.S If you look it uses software mailboxes when you want to kick the other cores core 1 = 0xe0 core 2 = 0xe8 core 3 = 0xf0 If you look at secondary spin you will see t...
by LdB
Tue Oct 15, 2019 12:42 pm
Forum: Bare metal, Assembly language
Topic: Clear bss section before or after setting up the MMU?
Replies: 4
Views: 167

Re: Clear bss section before or after setting up the MMU?

It has nothing to do with any of that it just needs to be cleared before you ever call any C code.
The BSS belongs to C or any other compiled language that uses it and it is worth taking 10 seconds to read up on it

https://en.wikipedia.org/wiki/.bss
by LdB
Tue Oct 15, 2019 10:21 am
Forum: Bare metal, Assembly language
Topic: How to use System Timers
Replies: 4
Views: 129

Re: How to use System Timers

Yep CLO will work and each count is a microsecond (1/1000000 of a second) not a millisecond (1/1000 of a second).
If you really want to use milliseconds multiply the value by 1000.

It's 0x3F003000 on a Pi3, the address in the document is from the VC4 (look at page 5)
by LdB
Tue Oct 15, 2019 9:23 am
Forum: Bare metal, Assembly language
Topic: How to use System Timers
Replies: 4
Views: 129

Re: How to use System Timers

Option 1.) Most of us have the equivalent of the linux sleep function on our O/S, we just sleep the task for a set time. Even basic RTOS's like FreeRTOS have a vDelay which is the same thing as a sleep, the task it put in the suspended queue and gets no processor time until it times out. Option 2.) ...
by LdB
Tue Oct 08, 2019 11:28 pm
Forum: Bare metal, Assembly language
Topic: Application freezes on atomic write to memory
Replies: 1
Views: 198

Re: Application freezes on atomic write to memory

ldaxr/stlxr requires the MMU to be on and the memory to be properly shared, read the manual on the instruction on the processor.
by LdB
Mon Oct 07, 2019 11:53 am
Forum: Bare metal, Assembly language
Topic: Setting the output register for a GPIO on Pi 4
Replies: 21
Views: 1062

Re: Setting the output register for a GPIO on Pi 4

Glad you found problem, but just for completeness

Check the actual manual CortexA72 manual it is very specific ... Table 4-17 MPIDR_EL1 bit assignments
http://infocenter.arm.com/help/index.js ... 49036.html
by LdB
Mon Oct 07, 2019 1:13 am
Forum: Bare metal, Assembly language
Topic: Setting the output register for a GPIO on Pi 4
Replies: 21
Views: 1062

Re: Setting the output register for a GPIO on Pi 4

@zhak are you sure the cores aren't just sent to hang because you are playing a very dangerous game. In the MPIDR_EL1 register bits[1:0] = CPU ID, bits [7:2] are Reserved on the CortexA72. Your code AND the register value to 0xFF and if none zero hang the core. So any bit set in those reserved bits ...
by LdB
Fri Oct 04, 2019 1:15 am
Forum: C/C++
Topic: Help loading PNG image to frame buffer
Replies: 11
Views: 577

Re: Help loading PNG image to frame buffer

No problems I did a similar kiosk type project with a mipi5000 touch screen, so it's good that the code wasn't wasted. I actually dealt with the touchscreen itself in much the same way by setting up a pthread reading "/dev/input/event0" The only other issue I then ran into was a boot up you had two ...
by LdB
Thu Oct 03, 2019 4:08 pm
Forum: C/C++
Topic: Help loading PNG image to frame buffer
Replies: 11
Views: 577

Re: Help loading PNG image to frame buffer

You are making hard work of it ... it's actually quicker to code it for you https://github.com/LdB-ECM/bmp_on_linux The actual 200 lines of code is here https://github.com/LdB-ECM/bmp_on_linux/blob/master/main.c My makefile turns that into bmplinux.cmd which is a linux executable. The bitmap file is...
by LdB
Wed Oct 02, 2019 5:11 pm
Forum: C/C++
Topic: Help loading PNG image to frame buffer
Replies: 11
Views: 577

Re: Help loading PNG image to frame buffer

The cheat is make the image depth the same as the screen and the same size as screen, then you can just jump the png header and write the rest of the file data to the frame buffer. The image may be upside down if png is a bottom up format but that is obviously easy to fix. If you want to go more cor...

Go to advanced search