Go to advanced search

by jahboater
Tue Aug 03, 2021 8:09 pm
Forum: Beginners
Topic: Improve performance of Raspberry Pi
Replies: 10
Views: 413

Re: Improve performance of Raspberry Pi

My smartphone, a S20FE, runs literal circles around my 4B 8GB. That is what a 8 core cpu running at almost double the clock frequency, plus a faster GPU will get you. It also costs 10 times as much. I wonder how long the smartphone maintains full speed? Given the high spec SoC combined with little ...
by jahboater
Tue Aug 03, 2021 8:02 pm
Forum: General discussion
Topic: First pi kit advice please
Replies: 7
Views: 209

Re: First pi kit advice please

pidd wrote:
Tue Aug 03, 2021 7:59 pm
First timer wrote:
Tue Aug 03, 2021 6:56 pm
The only bit I think excludes is WiFi which is important.
The Pi4 on your shopping list already includes Wifi 2.4Ghz & 5GHz
And GiGe ethernet ....
by jahboater
Tue Aug 03, 2021 10:19 am
Forum: General discussion
Topic: Zip keeps running out of memory
Replies: 77
Views: 1229

Re: Zip keeps running out of memory

Perhaps try "xz" which offers much more sophisticated compression.
And for your problem it has some control over the memory used:

Code: Select all

--memlimit=limit
See "man xz" for details, and scroll down to the "Memory usage" section.
by jahboater
Tue Aug 03, 2021 10:13 am
Forum: SDK
Topic: Timing a function's execution time.
Replies: 5
Views: 136

Re: Timing a function's execution time.

Hi All, I want to get the time in us that a function takes, so far I'm using this code, will this give me reliable results? uint64_t start; uint32_t time_taken; Why not use 64-bits for the "time_taken" variable too? And then simplify the code by removing the overflow/wrap checks.
by jahboater
Sun Aug 01, 2021 5:58 pm
Forum: General discussion
Topic: No revision info in /proc/cpuinfo
Replies: 9
Views: 366

Re: No revision info in /proc/cpuinfo

DougieLawson wrote:
Sun Aug 01, 2021 2:08 pm
Why aren't folks using the more reliable cat /sys/firmware/devicetree/base/model;echo which is easier than decoding the /proc/cpuinfo Revision string.
Also

Code: Select all

cat /proc/device-tree/model;echo
by jahboater
Sun Aug 01, 2021 9:37 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

So I really need some C idiom that means: "'on a CPU which can handle unaligned accesses itself, always do it that way; on a CPU that cannot handle unaligned accesses, call a library routine or emit code which does the load/save one byte at a time". But is there any language idiom or macr...
by jahboater
Sun Aug 01, 2021 8:06 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

Note if I add back in the two lines in the loop which are commented out, the Pico crashes when i=5. This suggests that all I need to do is search the code for all casts to int and replace them with suitable calls to memcpy. As a rough estimate $ grep 'int \*)' *.c | wc 123 1118 6576 suggests there ...
by jahboater
Sun Aug 01, 2021 3:19 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

It seems wrong to me that the compiler knows how to access an unaligned member in a packed structure but doesn't expose that for use more generally. Here is what the current standard says about alignment ..... 6.2.8 Alignment of objects 1 Complete object types have alignment requirements which plac...
by jahboater
Sun Aug 01, 2021 2:38 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

I'm surprised that *(int *)p is "telling" the compiler to use an aligned load, when I have explicitly declared p as unaligned; are you sure that's the case? But you have later explicitly declared that p is an int * - that's what the cast does. I guess that all "pointers to int" ...
by jahboater
Sun Aug 01, 2021 2:18 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

Can you catch SIGBUS ?
:)

(I think alignment faults usually crash the program with a "bus error").
by jahboater
Sun Aug 01, 2021 2:10 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

char *p = some_external_function(); int n = *(int *)p; In other words, I assumed that the (int *) cast was saying 'treat p as a pointer to an int' without additionally saying 'I promise that p is aligned'. Yes, I think it does. But it will still do a single LDR instruction regardless because that's...
by jahboater
Sun Aug 01, 2021 1:04 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

Perhaps there is something wrong with the declared target CPU? gcc -Q --help=target Shows the defaults, see "-munaligned-access [enabled]" (or not) near the end. See also __ARM_FEATURE_UNALIGNED -munaligned-access -mno-unaligned-access Enables (or disables) reading and writing of 16- and 3...
by jahboater
Sun Aug 01, 2021 12:42 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

In for(int i=0;i<4;i++){ ((char *)&link00)[i]=0; } it may be that the compiler replaces the entire loop with a single STR instruction (because it thinks link00 is aligned). Which explains why declaring it volatile works. Horrible! I am surprised that "memset(&link00, 0, 4)" doesn't...
by jahboater
Sun Aug 01, 2021 12:23 am
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

The proposed solution used memset and it also crashed. My guess is the optimizer recognized a call to the standard library and wondrously replaced it with a single instruction that tries to make an unaligned write. I haven't experimented, but my suspicion is the compiler is careful when writing thr...
by jahboater
Sat Jul 31, 2021 10:11 pm
Forum: Other programming languages
Topic: BBC BASIC on the Raspberry Pi Pico?
Replies: 70
Views: 1973

Re: BBC BASIC on the Raspberry Pi Pico?

Unfortunately, the suggested fix doesn't work. More surprisingly for(int i=0;i<4;i++){ ((char *)&link00)[i]=0; } also doesn't work, however for(int i=0;i<4;i++){ ((volatile char *)&link00)[i]=0; } works just fine. Now one gets to the prompt, but after that it still crashes. Is there a way t...
by jahboater
Sat Jul 31, 2021 10:15 am
Forum: General discussion
Topic: No revision info in /proc/cpuinfo
Replies: 9
Views: 366

Re: No revision info in /proc/cpuinfo

B.Goode wrote:
Sat Jul 31, 2021 10:12 am
Is this Operating System dependent?

Note that @mac21 says -
As a software developer that just startet with debian (no, I don't run raspbian)
Ah yes, very likely. Though /proc is created by the kernel.
I only ever use Raspberry Pi OS on Pi's so I cant verify that.
by jahboater
Sat Jul 31, 2021 10:05 am
Forum: General discussion
Topic: No revision info in /proc/cpuinfo
Replies: 9
Views: 366

Re: No revision info in /proc/cpuinfo

I found that topic telling me that cpuinfo does not work with arm64 but only with arm32: https://github.com/raspberrypi/linux/issues/2110 Does this mean I can throw my Pi4 into the trash can? Nonsense! In 64-bit mode, /proc/cpuinfo reports: Hardware : BCM2835 Revision : d03114 Serial : 10000000855a...
by jahboater
Fri Jul 30, 2021 7:52 pm
Forum: Beginners
Topic: How can I change the GPU memory to more than 128mb on Pi4?
Replies: 19
Views: 621

Re: How can I change the GPU memory to more than 128mb on Pi4?

This post is simply about GPU memory/overclocking. I read somewhere that there is nothing to be gained by gpu_mem exceeding 128MB (or was it 256MB?). Add "gpu_mem=256" (say) to your /boot/config.txt file with any text editor: sudo nano /boot/con<tab> To overclock a Pi4, add "arm_freq...
by jahboater
Fri Jul 30, 2021 5:47 pm
Forum: C/C++
Topic: The compatibility&Safty of C/C++ in PICO C SDK
Replies: 6
Views: 248

Re: The compatibility&Safty of C/C++ in PICO C SDK

dbrion06 wrote:
Fri Jul 30, 2021 3:01 pm
But it is very difficult to install gcc manual on RPian/Debian PCs
Yes. I forget that when you install gcc yourself, the man page is automatically installed too.

Code: Select all

apt-cache search gcc | grep doc
comes up with all sorts of stuff though.
by jahboater
Fri Jul 30, 2021 5:39 pm
Forum: General
Topic: Build project with makefile
Replies: 21
Views: 571

Re: Build project with makefile

We are horribly spoilt nowadays when it comes to build times! When I was a lad, just after punch cards didn't become a thing, we still had to wait for a considerable time (many minutes, sometimes hours) to get any Pascal compile results out of the MicroVAX we used at University. When I learned Pasc...
by jahboater
Fri Jul 30, 2021 10:17 am
Forum: C/C++
Topic: The compatibility&Safty of C/C++ in PICO C SDK
Replies: 6
Views: 248

Re: The compatibility&Safty of C/C++ in PICO C SDK

But some function like: sscanf_s() and sprintf_s() can't be recognized in PICO SDK. So I have to use unsafe functions :sscanf() and sprintf(). You probably want snprintf() which is portable. The "_s" versions are Microsoft specific. snprintf() checks the length to avoid buffer overflow. T...
by jahboater
Thu Jul 29, 2021 6:02 pm
Forum: C/C++
Topic: C++ development for the Raspberry
Replies: 13
Views: 872

Re: C++ development for the Raspberry

I'd tentatively suggest doing this natively. Use an rpi4 for development. +1 I use an 8GB Pi4 running at 2100MHz for most development now and find compilation times pleasingly quick. Use "make -j 4" to utilize all four cores if your project has multiple source files. Developing on a fast ...
by jahboater
Wed Jul 28, 2021 7:45 pm
Forum: Off topic discussion
Topic: New book by Brian Kernighan.
Replies: 35
Views: 3000

Re: New book by Brian Kernighan.

Sorry I can't link to where I read this but is some discussion of the history of C it was stated that the language was created specifically for the task of making the Unix kernel portable. That is recreating in a portable high level language what existed as assembler. Yes, its well known. UNIX was ...
by jahboater
Wed Jul 28, 2021 4:19 pm
Forum: General programming discussion
Topic: no experience, not sure where to start
Replies: 3
Views: 225

Re: no experience, not sure where to start

Sorry, but I think this would be useful.
Official Raspberry Pi Beginners Guide:
https://magpi.raspberrypi.org/books/beg ... ide-4th-ed
by jahboater
Wed Jul 28, 2021 4:14 pm
Forum: SDK
Topic: How to make VS Code show disassembled native code and do assembler stepping in a project with debug
Replies: 6
Views: 370

Re: How to make VS Code show disassembled native code and do assembler stepping in a project with debug

I was able to make GCC generate an assembler file from my C source, but it's extremely hard to find the corresponding code for some original C statement. Single stepping is a lot easier. No. Add the -fverbose-asm flag to the compile and (as well as the -S flag) and you will get the original C sourc...

Go to advanced search