Go to advanced search

by LdB
Fri Dec 13, 2019 9:26 am
Forum: Bare metal, Assembly language
Topic: BX LR Seg Fault
Replies: 5
Views: 154

Re: BX LR Seg Fault

You are carrying values in the registers r0 to r3 which printf will trash because it is allowed to trash them and worse you expect the flags to be maintained. Search ARM 32Bit calling convention. This for example is nonsense CMP R2, R5 @ largest value with max BL print_r2 BGT end You do a compare, b...
by LdB
Fri Dec 13, 2019 8:53 am
Forum: C/C++
Topic: platform independent c++ string length
Replies: 6
Views: 164

Re: platform independent c++ string length

tellp
http://www.cplusplus.com/reference/ostr ... eam/tellp/
In your case read the value stream.tellp();
by LdB
Fri Dec 13, 2019 8:00 am
Forum: C/C++
Topic: Data logger: write multiple channels in different columns (.csv)
Replies: 3
Views: 95

Re: Data logger: write multiple channels in different columns (.csv)

That is because gpio.h calls other headers which have relative paths from where it is located .. AKA its current folder That is why you don't move gpio.h at all you just change the path to it in the first instance of the error. So put it back where it was and fix the path in the first error and prob...
by LdB
Thu Dec 12, 2019 1:51 am
Forum: Bare metal, Assembly language
Topic: Pointer to BCM2835 counters - A nightmare
Replies: 8
Views: 363

Re: Pointer to BCM2835 counters - A nightmare

cleverca22 the timer system is subject to heavy priority restraints. Read the OP requirements at the top and why he is building a kernel driver. It really isn't suitable and it is going to be challenging enough doing it the way he is going. He is going the right way and up to number 4 on his list wh...
by LdB
Wed Dec 11, 2019 2:41 pm
Forum: C/C++
Topic: Simple example of class and object
Replies: 27
Views: 757

Re: Simple example of class and object

Have you ever used inheritance for real time project? and if yes then what was that ? Do you really think inheritance was really necessary for the project? Why did you think that inheritance is the right option for the project. ? Nope and that has nothing to do with C++ it is because it is rare for...
by LdB
Wed Dec 11, 2019 12:20 am
Forum: C/C++
Topic: Simple example of class and object
Replies: 27
Views: 757

Re: Simple example of class and object

He is playing mental hijinx where something like Circle isn't an O/S because it doesn't have apps, some sort of console to launch them and so on and whatever rubbish your swampdog O/S definition says. Circle is more like an RTOS which most of us would still call an O/S but not swampdog it fails his ...
by LdB
Tue Dec 10, 2019 3:01 pm
Forum: C/C++
Topic: Simple example of class and object
Replies: 27
Views: 757

Re: Simple example of class and object

I'm trying to get the OP to define what he means. We could debate what the wiki says there but methinks all we'd end up doing is going round in circles defining what an operating system is. To me you are the one going in circles, so lets just define it as like circle (a pun) from rst that is an ent...
by LdB
Tue Dec 10, 2019 2:47 pm
Forum: C/C++
Topic: Simple example of class and object
Replies: 27
Views: 757

Re: Simple example of class and object

You are getting sidetracked into stuff which has nothing to do with the OP question and is outside my care factor with C++. Lets just say I agree with whatever the book and you say about C++ to end that argument and get back to the OP. So the OP even asked you directly I am following same approach I...
by LdB
Tue Dec 10, 2019 10:13 am
Forum: C/C++
Topic: Help with GPCLK setup? My register assignments aren't working?
Replies: 7
Views: 161

Re: Help with GPCLK setup? My register assignments aren't working?

ERROR

Code: Select all

#define PI_2_BASE 0x20000000
#define PI_3_BASE 0xF2000000
Try

Code: Select all

#define PI_2_BASE 0x20000000
#define PI_3_BASE 0x3F000000
by LdB
Tue Dec 10, 2019 1:42 am
Forum: C/C++
Topic: From python to C/C++
Replies: 18
Views: 598

Re: From python to C/C++

On the off chance you are right can you send me said ARM compiler so that I can compare for myself? You can't send the compiler because it has a license and install, you can sign up for a free 30 day trial if you wish to evaluate, link below The funny part about his comment however is it uses a var...
by LdB
Mon Dec 09, 2019 4:12 am
Forum: C/C++
Topic: Simple example of class and object
Replies: 27
Views: 757

Re: Simple example of class and object

Your statement above is illogical ... embedded has no relationship to class. Embedded device simply means the device runs a fixed set of tasks that have limited ability to change. So all of your classes above may exist on an embedded system it depends what it does. The main reason you are classing t...
by LdB
Mon Dec 09, 2019 12:57 am
Forum: C/C++
Topic: Simple example of class and object
Replies: 27
Views: 757

Re: Simple example of class and object

The important things about a switch is it has states as heater correctly described it PIN M connects to PIN N. So what you can more easily describe is the states so if we go with M and N you can describe it as a state or enumeration of pole connections Your description of the switch themselves do th...
by LdB
Sun Dec 08, 2019 3:06 pm
Forum: C/C++
Topic: From python to C/C++
Replies: 18
Views: 598

Re: From python to C/C++

souper man wrote:
Sun Dec 08, 2019 7:01 am
Y = input('numberofloops: ')
for q in range (int(Y)):
The almost literal translation using #include <stdio.h> is

Code: Select all

int Y;
printf("numberofloops:");
scanf("%d", &Y);
for (int q = 0; q < y; q++)
{
     // whatever your python did after : 
}
by LdB
Sun Dec 08, 2019 1:09 pm
Forum: Bare metal, Assembly language
Topic: BL instruction vs. basic blocks
Replies: 12
Views: 496

Re: BL instruction vs. basic blocks

You need to stop and do some reading you aren't on an MCU ... the ARM has a pipeline. You are worrying about things that will have minimal impact except for code size because of the hardware. Data alignment and pipeline stalls will cost you more time than anything you are playing with. Its worse of ...
by LdB
Thu Dec 05, 2019 6:31 am
Forum: Bare metal, Assembly language
Topic: [Solved] multicore confusion
Replies: 6
Views: 296

Re: multicore confusion

No way out from that even if you send a SEV the core jumps out and back around the loop. They are supposed to read a mailbox after the wfe That code would really only be for QEMU the extra cores are already parked properly on the real Pi and read the mailbox when you poke them. The only time you see...
by LdB
Wed Dec 04, 2019 6:10 pm
Forum: Bare metal, Assembly language
Topic: Pointer to BCM2835 counters - A nightmare
Replies: 8
Views: 363

Re: Pointer to BCM2835 counters - A nightmare

This stuff varies from linux distro to linux distro the macro should be in hardware.h in the arch/arm directory if you can't find it just use ioremap, it will just create a new mapping to the address. The smallest size you can remap on the PI is 4096 bytes as defined by the MMU It probably has a #de...
by LdB
Wed Dec 04, 2019 3:27 pm
Forum: Troubleshooting
Topic: Raspberry pi 2 model B version 1.1 won´t boot. Need help
Replies: 1
Views: 61

Re: Raspberry pi 2 model B version 1.1 won´t boot. Need help

Looks like the power adapter is wrong it is supposed to be 5V 2A. I know when you try to use a 5V 0.5A it does that.
by LdB
Wed Dec 04, 2019 1:02 pm
Forum: Bare metal, Assembly language
Topic: Pointer to BCM2835 counters - A nightmare
Replies: 8
Views: 363

Re: Pointer to BCM2835 counters - A nightmare

The correct address is 0x3F003000 and you need to use the __io_address macro

Code: Select all

#define TIMER_BASE 0x3F003000 
timer = (volatile unsigned *)__io_address(TIMER_BASE);
by LdB
Wed Dec 04, 2019 6:51 am
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6211

Re: Where can I begin learning C/C++?

The irony of you accusing me of wasting time :-) Please explain what Python, Logo, Basic or half the other junk in the posts above has to do with learning C? If you are posting on topic I have no issue and I wouldn't complain. Now all we need is 20 posts about me complaining, that should really fini...
by LdB
Wed Dec 04, 2019 3:23 am
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6211

Re: Where can I begin learning C/C++?

You are posting in a C/C++ forum section .. and you ask the question :-)

Some of us don't want to wade thru this junk, can you ask it in an appropriate forum area .. General Programming discussion would probably be the go.
by LdB
Wed Dec 04, 2019 3:07 am
Forum: C/C++
Topic: Where can I begin learning C/C++?
Replies: 72
Views: 6211

Re: Where can I begin learning C/C++?

Talk about Necro a thread and taking it for a walk The OP asked a question about C/C++ back in Tue Oct 01, 2019 and hasn't been back since. Now we are talking about Python :-) People no-one cares especially the OP. Jamesh you said all that needs to be said a couple of posts above ... lock the thread.
by LdB
Wed Dec 04, 2019 12:50 am
Forum: Bare metal, Assembly language
Topic: i created a Led assembly that makes ON/OFF in a loop, but how can i create an SOS code in assembly?
Replies: 5
Views: 277

Re: How can i create S.O.S morse code @ Assembly

Just refactor your code with subroutines, let me do it long form The hint there is you can refactor it even smaller by simply adding more functions, I added just two LED_ON_FOR_DELAY_LOOP, LED_OFF_FOR_DELAY_LOOP You could actually bring them down to a single function with a more complex entry .secti...
by LdB
Tue Dec 03, 2019 4:17 pm
Forum: Bare metal, Assembly language
Topic: BL instruction vs. basic blocks
Replies: 12
Views: 496

Re: BL instruction vs. basic blocks

It is .. it even has a special name "Intra-procedure-call scratch register" :-)

Microsoft follows the same as GCC on there ARM compiler
https://docs.microsoft.com/en-us/cpp/bu ... ew=vs-2019
by LdB
Tue Dec 03, 2019 4:12 pm
Forum: Bare metal, Assembly language
Topic: i created a Led assembly that makes ON/OFF in a loop, but how can i create an SOS code in assembly?
Replies: 5
Views: 277

Re: How can i create S.O.S morse code @ Assembly

Turn the on off into a subroutine with a delay time (long and short) carry the delay value in R0

So an S is

Code: Select all

Flash led(short)
Fixed_Delay
Flash led(short)
Fixed_Delay
Flash led(short)
Fixed_Delay
An O is

Code: Select all

Flash led(long)
Fixed_Delay
Flash led(long)
Fixed_Delay
Flash led(long)
Fixed_Delay
by LdB
Tue Dec 03, 2019 3:14 pm
Forum: Bare metal, Assembly language
Topic: BL instruction vs. basic blocks
Replies: 12
Views: 496

Re: BL instruction vs. basic blocks

That is called calling convention and since you are writing the assembler that is up to you

You can see the GCC one
https://wiki.osdev.org/Calling_Conventions

As many compilers link to GCC c code they often just adopt GCC calling convention.

Go to advanced search