Go to advanced search

by jahboater
Sat May 27, 2017 2:01 pm
Forum: Beginners
Topic: Jessie-lite setup for Raspberry Pi Zero W
Replies: 8
Views: 9478

Re: Jessie-lite setup for Raspberry Pi Zero W

rdmcginnes wrote: Can this all be done to get the pizw up and running with ssh from a remote system, without a keyboard or display on the pizw?
My Pi Zero W has never had a keyboard or a monitor connected to it. Runs fine!
by jahboater
Thu May 25, 2017 7:47 pm
Forum: General programming discussion
Topic: deleting files
Replies: 6
Views: 1226

Re: deleting files

It is though a "General Programming" discussion, so I assumed some sort of programming language might be in order - and C is an obvious choice.
I do agree that "find" is entirely appropriate too!
by jahboater
Thu May 25, 2017 7:30 pm
Forum: General programming discussion
Topic: deleting files
Replies: 6
Views: 1226

Re: deleting files

Look at opendir(), readdir(), stat() (see "man opendir" for example and man fstat) also statvfs()
Then remove() or unlink()
Finish with closedir()
by jahboater
Thu May 25, 2017 10:48 am
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 24934

Re: How would you ...... in C ? (+ other C discussions)

Paeryn wrote: Quite often (more so on ARM than x86) some local variables can get optimised out of ever requiring physical memory storage with optimisations on.
You should see ARM64 code. It has 31 64-bit registers (and a handy zero register) - very frequently functions require no stack at all.
by jahboater
Thu May 25, 2017 10:35 am
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 24934

Re: How would you ...... in C ? (+ other C discussions)

It's better to leave your code easy to read and allow the optimizer to do it's job, sometimes you can make it harder for the compiler by trying to out guess it. Definitely agree here. Simplicity and readability are always the primary goal. In time though you do learn various methods that generally ...
by jahboater
Thu May 25, 2017 10:12 am
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 24934

Re: How would you ...... in C ? (+ other C discussions)

Talking of rabbit holes... I looked at the assembler versions of some short bits of my code yesterday. If anyone is looking at the assembler produced by the compiler, I strongly suggest GCC 7.1 if you can install it. Apart from better code for ARM, they have finally fixed "-fverbose-asm" in 7.1. It...
by jahboater
Wed May 24, 2017 6:25 pm
Forum: Troubleshooting
Topic: Pi 3 overheating
Replies: 11
Views: 2819

Re: Pi 3 overheating

fred44nl wrote:how can you tell that the processor is throttling down ??
https://github.com/MilhouseVH/bcmstat/b ... bcmstat.sh
Run this and you can see the temps/clock speeds in real time.
by jahboater
Wed May 24, 2017 5:56 pm
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 24934

Re: How would you ...... in C ?

I'd take exception with the #define inline , since C99 inline is a keyword in the language. Not a good idea to go around redefining it as something else. Yes of course. My definition has the same meaning, but makes it stronger. I just tried the plain C99 keyword in a program and and 38 less functio...
by jahboater
Wed May 24, 2017 5:41 pm
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 24934

Re: How would you ...... in C ?

I'd take exception with the #define inline , since C99 inline is a keyword in the language. Not a good idea to go around redefining it as something else. Yes of course. My definition has the same meaning, but makes it stronger. I just tried the plain C99 keyword in a program and and 38 less functio...
by jahboater
Wed May 24, 2017 3:31 pm
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 24934

Re: How would you ...... in C ?

And the non-gcc versions of your macros are just confusing because they don't do what they say they do e.g. functions that seem to be declared to be inline won't be inline and variables marked as unused may still generate "unused variable" warnings. But the code will still work, still compile, and ...
by jahboater
Wed May 24, 2017 1:38 pm
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 24934

Re: How would you ...... in C ?

IMO "int main(void)" is for embedded systems where there are no command line arguments to pass OK fair enough, how about something like this then (another way to make it portable)? #ifdef __GNUC__ #define pure __attribute__ ((pure)) #define unused __attribute__ ((unused)) #define packed __attribute...
by jahboater
Wed May 24, 2017 9:19 am
Forum: Off topic discussion
Topic: Suitable replacement for the Rpi?
Replies: 26
Views: 5254

Re: Suitable replacement for the Rpi?

That said, I do use some of the other boards when the application demands it. The XU4 has (easily) the most processing power, but I only have a few apps that need it. I prefer the C2 as it has the same armv8 Cortex-A53 processor as the Pi3/new Pi2 and the OS is 64-bit. The XU4 is armv7 which is the...
by jahboater
Mon May 22, 2017 4:20 pm
Forum: C/C++
Topic: How would you ...... in C ? (+ other C discussions)
Replies: 187
Views: 24934

Re: How would you ...... in C ?

trivia (but given your sig ;) ) ....

int main(void)

is a valid signature for main() and is more readable than

int main(__attribute__((unused)) int argc, __attribute__((unused)) char **argv)

There's two ;; after the loop in main.
by jahboater
Mon May 22, 2017 8:55 am
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13651

Re: Writing clean code isn't hard!

Is any one else thinking its's quite ironic that this thread is entitled "Writing clean code isn't hard" when clearly this thread shows that it really is hard to write REALLY clean code? Yes! see this post from earlier in the thread:- and who said "Writing clean code isn't hard" ;) I'm well aware o...
by jahboater
Mon May 22, 2017 8:32 am
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13651

Re: Writing clean code isn't hard!

I wasn't going to comment on your use of "volatile" because I don't know enough about ARM assembler to be able to look at the compiler output to know if what you said was correct or not. I could have done it on this AMD64 desktop but again I didn't know if the results would have been valid on an AR...
by jahboater
Sun May 21, 2017 11:28 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13651

Re: Writing clean code isn't hard!

Yes, your right, volatile is too strong a word.
But do try it some time - removing static from global data can cause a lot more code to be generated, though it does vary of course.
by jahboater
Sun May 21, 2017 7:23 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13651

Re: Writing clean code isn't hard!

It now compiles cleanly WITH -Wmissing-prototypes :D Cool - impressive. Its hard sorting out a big chunk of code for the first time, but easy afterwards. Your code is probably too good to have much global data, but any thats not declared static gets treated as volatile which is horrendously ineffic...
by jahboater
Sun May 21, 2017 8:25 am
Forum: C/C++
Topic: Cross-compiling libi2c-dev issue
Replies: 13
Views: 4722

Re: Cross-compiling libi2c-dev issue

I don't have x server installed on my system, I'm using raspberry pi zero and my only access to it is through ssh ;) and thats a problem because? :D How about getting a Pi3 with full Raspbian and cross compile on that? If you don't have physical monitor spare, just use the included VNC to display t...
by jahboater
Sat May 20, 2017 11:48 am
Forum: General discussion
Topic: Upgrade wrecked file system, sort of..
Replies: 10
Views: 1531

Re: Upgrade wrecked file system, sort of..

A commonly recommended card is the Samsung EVO+
I have many Samsung cards in Pi's over the years with never a problem and good performance.
by jahboater
Fri May 19, 2017 12:39 pm
Forum: C/C++
Topic: Cross-compiling libi2c-dev issue
Replies: 13
Views: 4722

Re: Cross-compiling libi2c-dev issue

it's easier to code and compile on the same computer Yes of course - and the Pi has a wide choice of editors to code with! and it's a good exercise to understand how things work. Fair enough! Thats a good reason. 3 - It could be useful for future projects to have a working toolchain For all this re...
by jahboater
Fri May 19, 2017 9:18 am
Forum: C/C++
Topic: Cross-compiling libi2c-dev issue
Replies: 13
Views: 4722

Re: Cross-compiling libi2c-dev issue

Because for now it's really small but it'll not stay long. That's why I'm trying to cross-compile it, for later use. OK. You can use the makefile to only compile the modules recently changed, each of which should be small even if the whole program is large - and make -j4 will use all four cores to ...
by jahboater
Fri May 19, 2017 8:35 am
Forum: C/C++
Topic: Cross-compiling libi2c-dev issue
Replies: 13
Views: 4722

Re: Cross-compiling libi2c-dev issue

I'm currently trying to cross-compile a small program to communicate through i2c with an accelerometer. When I compile on my raspberry pi, there is no problem but when I'm trying to compile on my computer, the linker doesn't find the library. Then why not save yourself lots of trouble and just comp...
by jahboater
Thu May 18, 2017 5:17 pm
Forum: Off topic discussion
Topic: Suitable replacement for the Rpi?
Replies: 26
Views: 5254

Re: Suitable replacement for the Rpi?

The serial console port, the IR receiver, the default power connector (located where the Pi has the analog audoi/video), no CSI, no DSI. On the bottom, the microSD connector is nowhere near the same spot and it has an eMMC connector in the middle. All that is true, and if you re-read my post you wi...
by jahboater
Thu May 18, 2017 2:38 pm
Forum: Off topic discussion
Topic: Suitable replacement for the Rpi?
Replies: 26
Views: 5254

Re: Suitable replacement for the Rpi?

*None* of those boards is a "Raspberry Pi clone". There has only *ever* been one actual clone (the Odroid-W, a clone of the Model B, aka Pi1B) and there were only 5K of them built before it was withdrawn from sale. All of those boards use different S0Cs than the Pi does. And, by the way, the Odroid...
by jahboater
Thu May 18, 2017 10:40 am
Forum: Off topic discussion
Topic: Suitable replacement for the Rpi?
Replies: 26
Views: 5254

Re: Suitable replacement for the Rpi?

Could you explain the problem in more detail?
What do you think is the limiting factor?

You cant just swap SD cards around and expect it to work.

Go to advanced search