|
This message has been flagged as potential spam and is awaiting moderation
|
|
|
|
|
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 am on the opposite side (at work): forced to use C while I would use C++ instead.
As others suggested C++ follows the Zero-overhead principle[^].
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
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
|
|
|
|
|
watch out for memory allocation. Project I was on 5+ years ago was burned with "new" and other items for memory allocation not being thread safe. There was a macro to define that fixed everything.
Charlie Gilley
“Microsoft is the virus..."
"the problem with socialism is that eventually you run out of other people's money"
|
|
|
|
|
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!
|
|
|
|
|
Not the interest there used to be in the CCC maybe it's run it's course ?
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
|
|
|
|
|
|
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 7hrs 15mins 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
|
|
|
|