|
Working with an STM32 device and trying to implement program in c++. Every platform is a little different in the way it implements C++ so trying to learn the ins and outs on the STM32.
Been working on a simple Timer singleton class for the past 6 hours and it's been 2 steps forward and 1 back. Should be fairly easy but there were so many gotchas that made it very frustrating.
A home without books is a body without soul. Marcus Tullius Cicero
PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com
Latest Article: EventAggregator
|
|
|
|
|
Sounds painful, but also like article material.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
I'm probably old fashioned, but I don't find C++ that helpful when it comes to embedded work - stick to C and assembler is my preferred route.
The idea of embedded is to get the best performance out of limited resources (speed, memory and / or power) and the extra overhead of class based OOPs isn't necessarily a good idea. And it's way harder to keep an eye on memory management to ensure memory fragmentation doesn't rear its ugly head after 2 weeks of continual runtime ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: I don't find C++ that helpful when it comes to embedded work
I disagree c++, I've used C++ on various platforms for years and never had a problem.
I find; code size comparable, speed acceptable (you can also mix c++ and assembler).
The Arduino platform uses c++ as it's major language and there are libraries for everything under the sun.
A home without books is a body without soul. Marcus Tullius Cicero
PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com
Latest Article: EventAggregator
|
|
|
|
|
Forget classes. template and constexpr mean I can create faster/more efficient code in C++ than you can readily create in C.
You don't have to use features that generate overhead in C++. Zero overhead C++ is a thing.
Besides, Generic Programming > Object Oriented Programming anyway
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
I use the C runtimes with C++ language features on embedded.
I avoid the STL and most of the C++ standard runtimes.
Why?
For the exact reasons you're running into - the C runtimes in general are far more consistent platform to platform.
Furthermore, The STL is not set up to use the heap responsibly on constrained systems. You will get heap frag and eventual crashes without creating your own custom allocators for everything.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
honey the codewitch wrote: I avoid the STL and most of the C++ standard runtimes.
Ditto
I ran into problems because of basic stupidity on my part and trying to do something that I hadn't done before.
Responsible memory/resource management is crucial in all embedded languages.
I generally don't do dynamic memory allocation, just instantiate classes once. When I do need to do dynamic memory allocation I attempt to allocate blocks that are the same size to reduce fragmentation. When I can't do that I am very cautious to destroy when done with.
You can shoot just as big a hole in your foot using C as C++!
A home without books is a body without soul. Marcus Tullius Cicero
PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com
Latest Article: EventAggregator
|
|
|
|
|
I guess I misunderstood some of your initial comment. I am not fully coffee'd yet.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Maiden upset by gut size (9)
(Posted at 09:00, but in a different universe) :InnocentWhistle:
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Nice one
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
Just so you know I solved it
Magnitude
In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity. - Hunter S Thompson - RIP
|
|
|
|
|
I thought you had! Well done:
Maiden MAIDEN
upset by (anag)
gut GUT
size MAGNITUDE
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Very kind of you!
|
|
|
|
|
Will it EVER END?????
Hogan
|
|
|
|
|
Ok, hands down, this beats TNG's not-so-subtle instances of "47" appearing everywhere. That was an inside joke, but in this case I just might rule it out as lazy writing.
OMG, there's a video of that also...
modified 1hr ago.
|
|
|
|
|
I am soooo tired of my iPhone. I'm about to get my AR15 out and take both to the gun range.
I'm whining now, so bear with me. All I want to do is delete ALL TEXT MESSAGES from my phone. None of the youtube videos help, and apple support is approaching Microsoft's level of stupidity. wtf happened to rm -rf? or delete all.. are you sure? yes.
Stupid. But if you have any spoilers the leash is running ios 17.
Charlie Gilley
“Microsoft is the virus..."
"the problem with socialism is that eventually you run out of other people's money"
|
|
|
|
|
Perhaps, had you an axe. And a buckskin jacket.
|
|
|
|
|
I have both, but no iPhone...
Will Rogers never met me.
|
|
|
|
|
|
Does this help?
- Open the Messages app: Launch the Messages app on your iPhone.
- Tap "Edit" in the top-left corner: On the Messages list screen, tap the Edit button in the upper-left corner.
- Select "Show Recently Deleted": If you only want to delete certain conversations, you can select them individually, but for all messages, proceed to step 4.
- Choose "Select Messages": After tapping "Edit," you should see an option to Select Messages.
- Select all conversations: Tap on each conversation that you want to delete. Unfortunately, iOS doesn't offer a single "Select All" button, so you’ll need to tap each conversation individually.
- Delete: Once you’ve selected the conversations, tap the Delete button (usually in the bottom-right corner).
/ravi
|
|
|
|
|
believe me, I tried this (multiple videos, etc). The process escapes me.
I'll give another shot later today.
Charlie Gilley
“Microsoft is the virus..."
"the problem with socialism is that eventually you run out of other people's money"
|
|
|
|
|
...or simply slide left on each conversation.
|
|
|
|
|
charlieg wrote: I'm about to get my AR15 out and take both to the gun range.
If you do make sure you post the video.
Oh, and send it to Tim Crook.
|
|
|
|
|
Had a meeting with a new client in the UK, for some short term work getting a little IoT widget functioning the way they'd like. It's a simple widget and they don't have actual coders in house so I went with Arduino.
Or tried.
So here's me failing live over Anydesk and Teams to get this ridiculous Waveshare board working under Arduino.
Turns out it won't. At least the touch panel won't work. Nobody has done it. It requires the ESP-IDF, not Arduino. Wish I would have done more research on this before the meeting.
In my SVG stuff my gradients are kind of rendering? But it looks like they stop just after the left edge.
I checked through all the drawing routines, including this mess that builds up thousands or tens of thousands of "spans" which are arbitrary length runs of a particular color at a y and x coordinate.
I spot checked the spans against my reference implementation, which should have been the last mile before the draws, and in 6000 or so I checked about half dozen across the arrays, and they were all the same.
I'm out of moves.
Some days it just doesn't pay to get out of bed.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|