Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Save on send plugin #28

Merged
merged 2 commits into from
Mar 30, 2016
Merged

Conversation

nkrkv
Copy link
Contributor

@nkrkv nkrkv commented Mar 30, 2016

It allows to permanently save uploaded program in flash

@gfwilliams
Copy link
Member

Thanks - merging in as it's off by default.

However wrapping all the code in onInit is a hugely bad idea I'm afraid. Sticking the code in a function means that Espruino must buffer the whole thing (modules and all) as one giant string.

It'll use a massive amount of memory (double, at least), and might even cause you some upload problems. It's just going to cause your customers a whole lot of pain.

If you absolutely want to do it, I'd say you should do an acorn parse and pull all the Module.X calls and function declarations outside onInit.

@gfwilliams gfwilliams merged commit 9263923 into espruino:gh-pages Mar 30, 2016
@nkrkv
Copy link
Contributor Author

nkrkv commented Mar 30, 2016

Thanks!

Yep, it definitely a hack far from being a solution. I'm thinking what if I'll put the program as is, directly on flash? I.e. not program → interpreter eval → interpreter dump → flash but program → flash → reset.

I want to try this utilizing Flash library perhaps. What do you think will I stumble somewhere?

@gfwilliams
Copy link
Member

Ahh - program → interpreter eval → interpreter dump → flash isn't what happens. It's actually:

program → interpreter eval → copy RAM to flash

Probably the best solution for you would be to implement: espruino/Espruino#740

I'll post more info in there in a second

@nkrkv nkrkv deleted the save-on-send branch March 31, 2016 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants