cnlohr / esp82xx

Useful ESP8266 C Environment
Other
289 stars 107 forks source link

Dev #20

Closed cnlohr closed 8 years ago

con-f-use commented 8 years ago

@cnlohr wrote:

I made a ton of changes. Most of the big functional changes I wanted to make in esp82xx are in (At least the important ones). Take a look if you get time. I hope you have been able to test things out on a better module!

Great changes! Looks alot cleaner now. As mentioned, I got my NodeMCU.¹ I got to testing a bit. No problems so far! It's soooo much nicer to flash firmware over the network. Also no button-presses!

Small things:

¹As my luck would have it, I had to change the ESP on the NodeMCU because shipping damage :-/ Good that my other ESP-12Es came an hour later, exactly when I figured, what the problem was. On the plus side I could salvage the faulty modules' larger flash chip. Soldered it to one of my ESP-01 modules. Now I have two working and net-burnable modules. Yay!

cnlohr commented 8 years ago

You know, I've never heard of strtok It does look like it solves a different problem, though.

This function "pops" a parameter off the global parameter stack, and reports whether it was successfully popped.

I do agree the function name is pretty awful.

Also, the implementation leaves a lot to be desired. Do you know if there's any way to pass variables by register-reference in GCC? Google wasn't too clear on this, but, on the lx106, parameters are passed by register. If I could update those registers and accept the different values in the caller, that would be the best of every world. The problem is when I passed them in as pointers the code size ballooned because GCC was constantly trying to push these things on the stack, make references to them and everything was just crazy.

Hmm, now I wonder if I can "trick" gcc into believing it's passing the registers by value and changing them anyway.

con-f-use commented 8 years ago

This function "pops" a parameter off the global parameter stack, and reports whether it was successfully popped.

Exactly what strtok(...) does, except that you pass it the parameter stack at first call and then NULL as long as you want to pop from the same stack.

And sorry no idea how to pass by register-reference. Not even sure what you mean :'(

cnlohr commented 8 years ago

Hmm, I guess what I have is pretty close to that, then! I wonder if it would be more memory-efficient to just implement strtok. Only thing it doesn't do would be the whole argument-counting I do.

Re: Register-reference. I don't know what you would call it, but the lx106 architecture passes parameters in registers. I wish I could tell GCC "hey, that register, keep using it once you're done, don't save it or back it up or anything. Trust me. I'm an engineer." I do not believe such a thing would exist, though :( -- mostly because that would be C++'s & operator.