Hi everyone,
When testing program memory usage, i typically edit the pxt-worker.js file found here:

I typically edit this line:
To always throw the error, and provide a bit more info:
It seems that the micro:bit runs at nearly 91% program memory capacity with just the underlying layers programmed to it. So that does not leave a whole lot of room. My expectations were that with the release of V2 and it having double the program memory, that adding my code would not be an issue. However, it does not seem that the pxtworker.js gets the proper information about the available flashsize depending on which version you are using. I tried adding in a V2 only feature such as sound to hopefully trigger something, but no luck. So my question is twofold:
- How much extra program memory is now available with V2
- Are there any suggestions to increasing program memory for V1? I seem to run out constantly by adding any functions of complexity. Are there any low hanging fruit I could remove from the core or elsewhere to free up space?
Thanks,
Josh
Hi there,
I never heard back on this one at all and we could REALLY use some help. With our added blocks in our custom IDE (code.brilliantlabs.ca), we are constantly running out of program memory with students using WiFi MQTT in combination with program memory heavy code such as the music blocks. It appears as though V2 is not utilizing the new addition of flash memory space. I see how incorporating this into the IDE can be tricky as you can’t assume if someone is using a V1 micro:bit or V2 (unless they grab a V2 specific block). Is there anything that can be done to help alleviate program memory issues for our IDE for students using V2 micro:bits? @peli ?
Thanks,
Josh
In a desperate attempt, I modified pxttarget.json to change the “flashEnd” parameter from 242688 to 300000 just for testing since the nrf52 chip has 512KB of memory I knew I was well under. To my amazement, it somehow seems to be working! I thought for sure that this would break down at the linker level with memory areas being overrun, but I am now able to add an endless amount of code and no issues. Now of course, the consequence is that it breaks V1, but for our IDE, we will explore the idea of two buttons to download with, V1 and V2 and see how to have the assembler.ts and hexfile.ts files use the appropriate target.flashEnd size.