If I erase_flash and then upload my m8rscript code (https://github.com/cmarrin/m8rscript) my code doesn't start up. The boot rom has some nice debug prints, but they output at and oddball baud rate of 74880, which is why you see gibberish when you reset you Esp. So I connected a term at that baud rate:
python -m serial.tools.miniterm /dev/tty.usbserial-AD02CUJ5 74880
and I get a message saying:
rf_cal[0] !=0x05,is 0xFF
I found out that his is caused because the RF Calibration sector(s) have been cleared to 0xff. When I upload esp_init_data_default.bin to 0x3fc000 ( a value I really had to dig for) everything started to work again.
I've hunted down clues that others have encountered this as well. In fact the nodemcu project mentions that they will initialize the RF calibration sectors for you if they're not already. But I couldn't find any code that did anything like that.
So I started digging into user_rf_pre_init(). This is a function that gets run before the RF cal, presumably for the very reason of initializing the sector if needed. But I haven't found any code to do that. I did add some debug prints to this this function and user_rf_cal_sector_set(). Both are called before the dreaded error message. So it looks like I can add some logic there.
But here's my problem. I don't really understand how all this actually works. When the RF calibration sector is correct, it shows the message:
rf cal sector: 1019
rf[112] : 00
rf[113] : 00
rf[114] : 01
If I return some random sector from user_rf_cal_sector_set(), the returned value replaces 1019 above, but the 3 values printed stay the same. So where are those numbers actually coming from?
Has anyone been trying to tackle this?