|
1. The lounge is for the CodeProject community to discuss things of interest to the community, and as a place for the whole community to participate. It is, first and foremost, a respectful meeting and discussion area for those wishing to discuss the life of a Software developer.
The #1 rule is: Be respectful of others, of the site, and of the community as a whole.
2. Technical discussions are welcome, but if you need specific programming question answered please use Quick Answers[^], or to discussion your programming problem in depth use the programming forums[^]. We encourage technical discussion, but this is a general discussion forum, not a programming Q&A forum. Posts will be moved or deleted if they fit better elsewhere.
3. No sys-admin, networking, "how do I setup XYZ" questions. For those use the SysAdmin[^] or Hardware and Devices[^] forums.
4. No politics (including enviro-politics[^]), no sex, no religion. This is a community for software development. There are plenty of other sites that are far more appropriate for these discussions.
5. Nothing Not Safe For Work, nothing you would not want your wife/husband, your girlfriend/boyfriend, your mother or your kid sister seeing on your screen.
6. Any personal attacks, any spam, any advertising, any trolling, or any abuse of the rules will result in your account being removed.
7. Not everyone's first language is English. Be understanding.
Please respect the community and respect each other. We are of many cultures so remember that. Don't assume others understand you are joking, don't belittle anyone for taking offense or being thin skinned.
We are a community for software developers. Leave the egos at the door.
cheers,
Chris Maunder
The Code Project | Co-founder
Microsoft C++ MVP
modified 16-Sep-19 9:31am.
|
|
|
|
|
I love this widget. It's a system-on-a-chip powered by a Tensilica Xtensa LX6 processor, with integrated WiFi, Bluetooth, BLE, and "ESP-NOW" radio protocols, a hardware TCP/IP stack, a generous array of I/O options including ADCs, DACs, UARTS, I2S, SPI, I2C and digital inputs and outputs, all on an array of about 36 remappable (software multiplexable) pins.
All for like $5-$10 for one already on a development board you can use.
That's the great part.
Why is it awkward?
It has about 320kB of usable RAM, and about 4MB of flash storage. The RAM is a bit on the generous side. I rarely use even half of it. The flash program storage (once you account for on-flash system files, over the air updates, "eeprom" and library code) is utterly anemic. The bluetooth stack alone is huge. Then you add in the WiFi support so you're using all the major radio comms features and you're looking at like 40% of your program space being used before we even talk about the code you've written that uses it. It is basically not possible to use all the major features of this device with the small amount of program storage space you are given.
Furthermore, things look bad once you start using most of the space, since no toolchain i've used supports incremental patching of the uploaded firmware - i don't think it's possible.
You're stuck uploading 4MB over UART at max 921600 baud every time you make a change in the code.
If you're lucky enough to have a not-so-common WROVER-dev-kit you have onboard JTAG via USB but you can't upload with JTAG, only debug with it.
Because the dev cycles are so long and it's slow or not possible to step through debug it, it means you probably aren't going to use both of its dual cores unless you're very brave and very patient. The second core is just going to run the network stack and spend most of the time idling.
So it's a curious choice of technology.
If it were me i would have
1. Increased the flash size to 8MB
2. Allowed for upload via JTAG
3. Cut the 2nd core
You can get single core ESP32s variants but they're not very common.
You can get Espressif to make you variants but it's not cheap. They also have some variants they sell on custom order like the WROVER.
One of these days a chinese company like Espressif is going to figure out that they'd make a mint doing end to end manufacture-to-order of the SoCs all the way to building custom PCBs protos that use their SoCs as well and then they are going to dominate the industry until everyone starts doing it too because any amateur will be able to proto like a pro using those services.
Real programmers use butterflies
|
|
|
|
|
honey the codewitch wrote: It has about 320kB of usable RAM, and about 4MB of flash storage. The RAM is a bit on the generous side. I rarely use even half of it. Sounds like a limited Amiga from 30 years ago.
Ode this, to Denise and Fat Agnus.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Yeah but it's a lot smaller, runs at 240mhz, and runs on a lot less power. The dual core 32-bit CPU is significantly more powerful as well. I also think there's more I/O.
Real programmers use butterflies
|
|
|
|
|
For no reason of which I am aware, I suddenly began to compare certain aspects of my careers (real life: chemistry vs. continuing story: programming).
A particular aspect of the two that really distinguishes the two is the type of results one expects.
With a computer program it is a series of steps/procedures/what-ever's that are deterministic. I am using the term 'deterministic' to imply that the results of specific input exactly defines the specific output. That is, in fact, the real point of using the computer: exactly predictable outcomes. It cannot be a mere 99.9999% predictable or, if you think of it and how many operations take place for almost anything calculation of consequence, that one-chance-in-a-million of uncertainty would make it useless. It sort of follows one of Einstein's quotes to the effect that 'insanity is doing the same thing over and over again and expecting different results'.
Now contrast that with chemical processes. They're really all statistical. For any of you who've taken organic chemistry, you know that you are looking for a "% yield" - in other words taking a bunch of stuff and putting them through a process has a multitude of outcomes. Not only that, but let's say you have a 70% yield as a predicted outcome (from previous information). You still will not likely see exactly 70% but will, if your "recipe" was well documented, have an expectation of something like 70±10 % as the yield. So there's uncertainty at two levels: what the reactants will do when they interact and a bit of kismet. Throw in that your starting materials are real substances that will "invariably vary" and it completes the fog. In organic chem lab, your product generally started out looking like (and was part of) a tar.
All that being said, it works damn well and chemistry is part of everything around you that makes life good. Forget popular opinions - nearly everything you look at required chemistry to bring it about.
Now, for computers, you could break that determinsitic paradigm you have built the perfect Turing Test. For chemistry, there are some reactions that are essentially "quantitative" meaning that all of the reactants go to a single product limited only by the relative proportions of the reactants (something might be in excess). A beautiful example of the latter is the preparation of cobaltus tetrakis(thiocyanato)mercurate. You mix solution of two salts and, after an induction period, it begins to form a brilliant blue snow storm, continuing towards this single inorganic polymer product until one reagent is totally exhausted. It is, however, a rare thing. I tried to find some videos of it but they were made by bored hacks. Here's a still[^]
So now, I'm in a world of a + b always gives c as before it was c (and some d, e, f, . . . ). In a way, we have it easy. As long as the plug isn't pulled or coffee spilled.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Garbage in, Salad out.
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|
theoldfool wrote: Garbage in, Salad out
The words of a Jedi Compost Master ! ?
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Or the words of someone who hates what my grandfather called "rabbit food".
|
|
|
|
|
Just consider this about rabbit food: rabbits have a pretty good time making more rabbits. That food is definitely good for something!
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
The words of a ?Jedi Compost Master dreamer.
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|
Chemistry has no "undo" button.
|
|
|
|
|
W∴ Balboos, GHB wrote: Now, for computers, you could break that determinsitic paradigm you have built the perfect Turing Test.
Your ways of finding one needs refinement.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
If you're not part of the solution, are you part of the precipitate?
"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!
|
|
|
|
|
"... there's good money to be made in prolonging the problem." -- Despair
|
|
|
|
|
Said every pharmaceutical company executive on the planet.
|
|
|
|
|
Condense readers understand the difference? I won't resort to micelle for an answer, preferring to keep you readers in suspension.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Don't know, I'll have to flask my friend Florence Erlenmeyer.
"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've been repurposing a bunch of my old C# code for use as C++ code on microcontroller devices.
This is going far far better than I would have ever imagined.
For starters, C# under .NET is a garbage collected memory pig.
The environment this code gets ported to could not be more different. I have 320kB of usable RAM, no garbage collection, and an allergy to new and malloc .
And yet my JSON parser i built for it was originally written in C#. It will run comfortably on 4kB of RAM. The same code on .NET uses tens of megabytes or more.
And don't get me started on my latest endeavor - stealing Microsoft .NET's SynchronizationContext paradigm for use on my ESP32 IoT devices.
Porting the code was cake, in both of the above cases. It was almost too easy.
It's shocking to me because the differences in environments and development paradigms are profound, but the code is almost copy-paste-search-replaceable in terms of porting it.
C#/.NET:
private struct Message
{
public SendOrPostCallback Callback;
public object State;
public ManualResetEventSlim FinishedEvent;
}
C++/ESP32:
struct Message
{
std::function<void(void *)> callback;
void *state;
TaskHandle_t finishedNotifyHandle;
};
It's the same code!
Callback: C++ functor vs. C# singlecast delegate
State: C++ void* vs. C# object
Finished event: C++ TaskHandle_t based notification vs C# ManualResetEvent
It's incredible how similar it is for something so platform specific. And now that C++ has things like coroutines and awaitable methods it will be even easier to port .NET code to C++ going forward.
How did this happen? When did this happen? I'm thrilled!
Real programmers use butterflies
|
|
|
|
|
OK - now it's time to really "put the pedal to the metal" and port this to C . Those last bits of fluff will fade away.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
In recent years I haven't found a good use case for strict C development except in one case (ESP8266 IDF) due to a broken developers framework.
Even my little 8-bit monsters, while not supporting most of the STL, will handle classes and functors and things like that just fine, with just 4-8kB of RAM.
I mean, several years ago it wasn't uncommon to find devices with less RAM than that. Now you have to go out of your way to find them.
So don't get me wrong - I'm not saying those use cases for C don't exist. But they seem rare these days, and I personally don't tend to encounter them.
Real programmers use butterflies
|
|
|
|
|
The suggestion was purely for sport programming.
Actually, it's been a very long time since I've done sport program. That was for FORTRAN callable assembly functions on a VAX/VMS system - myself and a (now deceased) friend would compete for who could make the most compact version of a function.
In your specific case, any space saved could be used to install some games. If none found are small enough, that becomes yet another challenging project!
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
When I was younger, sport programming involved rewriting autoexec.bat and config.sys to play a game: getting the sound card and mouse working together, sometimes with EMM386, sometimes without - that kind of thing.
I'm pretty sure I spent more time and effort on that than playing the damn game sometimes!
"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!
|
|
|
|
|
"I didn't mention the bats - he'd see them soon enough" - Hunter S Thompson - RIP
|
|
|
|
|
Quote: For starters, C# under .NET is a garbage collected memory pig.
That is one of several reasons why I have nothing what so ever to do with it.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
I don't mind it because all that memory use buys me things, and I have more RAM than sense on a modern desktop anyway.
Still, it is a little off putting at first.
There are some great ideas in there though, like the way you can pass calls around to execute on other threads instead of having to do synchronization through read/write barriers.
Real programmers use butterflies
|
|
|
|
|