craggmire 1 Posted November 11, 2014 Share Posted November 11, 2014 Thanks @@spirilis for two good & important points. I am coming up against a RAM size issue - my sketches are too big primarily as more library files are added. The CC3200 has 256Kbytes of RAM but I think the amount for each sketch is around 80Kbytes as the rest is, I guess, occupied by the OS. If this restriction is something that has to be lived with, is it possible to get sketches to swap themselves in and out of RAM from the on-board flash (which itself is limited to 1024Kbytes - I believe? Quote Link to post Share on other sites
Devan 0 Posted January 11, 2015 Share Posted January 11, 2015 Thanks @@spirilis, with SLFS i can make this crazy thing If this restriction is something that has to be lived with, is it possible to get sketches to swap themselves in and out of RAM from the on-board flash (which itself is limited to 1024Kbytes - I believe? Yes #include <SLFS.h> #include <WiFi.h> //using "xxd -i" in previously compiled binary unsigned char blink[] = { 0xa4, 0xcb, 0x00, 0x20, 0xcd, 0x44, 0x00, 0x20, 0xc5, 0x44, 0x00, 0x20, 0xc7, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xc9, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x99, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x44, 0x00, 0x20, 0xc3, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0xcb, 0x44, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x20, 0x01, 0x21, 0x00, 0xf0, 0xaa, 0xb8, 0x08, 0xb5, 0x01, 0x21, 0x1d, 0x20, 0x00, 0xf0, 0xe3, 0xf8, 0x4f, 0xf4, 0xfa, 0x70, 0x00, 0xf0, 0x0a, 0xf8, 0x1d, 0x20, 0x00, 0x21, 0x00, 0xf0, 0xdb, 0xf8, 0x4f, 0xf4, 0xfa, 0x70, 0xbd, 0xe8, 0x08, 0x40, 0x00, 0xf0, 0x00, 0xb8, 0x38, 0xb5, 0x45, 0x00, 0x00, 0x24, 0xac, 0x42, 0x05, 0xd0, 0x4f, 0xf4, 0xfa, 0x70, 0x00, 0xf0, 0x04, 0xf8, 0x01, 0x34, 0xf7, 0xe7, 0x38, 0xbd, 0x00, 0x00, 0xb0, 0xf5, 0x7a, 0x7f, 0x73, 0xb5, 0x04, 0x46, 0x08, 0xd3, 0x4f, 0xf4, 0x7a, 0x76, 0xb0, 0xfb, 0xf6, 0xf5, 0x28, 0x46, 0xff, 0xf7, 0xe7, 0xff, 0x06, 0xfb, 0x15, 0x44, 0x0b, 0x4b, 0x18, 0x68, 0x50, 0x23, 0x20, 0xf0, 0x7f, 0x41, 0x63, 0x43, 0x8b, 0x42, 0x04, 0xd9, 0x03, 0xf5, 0x7e, 0x02, 0x02, 0xf5, 0x47, 0x43, 0x7f, 0x33, 0x05, 0x48, 0x02, 0x68, 0x88, 0x1a, 0x20, 0xf0, 0x7f, 0x42, 0x01, 0x92, 0x01, 0x98, 0x98, 0x42, 0xf6, 0xd9, 0x7c, 0xbd, 0x00, 0xbf, 0x18, 0xe0, 0x00, 0xe0, 0x07, 0x4b, 0x1a, 0x68, 0x50, 0x1c, 0x10, 0xb5, 0x18, 0x60, 0x00, 0x24, 0x05, 0x49, 0x63, 0x58, 0x0b, 0xb1, 0x01, 0x20, 0x98, 0x47, 0x04, 0x34, 0x20, 0x2c, 0xf7, 0xd1, 0x10, 0xbd, 0x00, 0xbf, 0xa0, 0x4b, 0x00, 0x20, 0x80, 0x4b, 0x00, 0x20, 0x70, 0x47, 0x70, 0x47, 0xfe, 0xe7, 0xfe, 0xe7, 0xfe, 0xe7, 0xfe, 0xe7, 0x38, 0xb5, 0x00, 0x23, 0x19, 0x4a, 0x1a, 0x49, 0x98, 0x18, 0x88, 0x42, 0x04, 0xd2, 0x19, 0x4d, 0x58, 0x59, 0x98, 0x50, 0x04, 0x33, 0xf5, 0xe7, 0x1b, 0x48, 0x1c, 0x49, 0x4f, 0xf0, 0x00, 0x02, 0x88, 0x42, 0xb8, 0xbf, 0x40, 0xf8, 0x04, 0x2b, 0xff, 0xf6, 0xfa, 0xaf, 0x00, 0xf0, 0x00, 0xf9, 0x11, 0x4d, 0x12, 0x4b, 0xec, 0x1a, 0xa5, 0x10, 0x00, 0x24, 0xac, 0x42, 0x05, 0xd0, 0x0f, 0x48, 0x50, 0xf8, 0x24, 0x10, 0x88, 0x47, 0x01, 0x34, 0xf7, 0xe7, 0x0d, 0x4a, 0x0d, 0x48, 0x81, 0x1a, 0x8d, 0x10, 0x00, 0x24, 0xac, 0x42, 0x05, 0xd0, 0x09, 0x4b, 0x53, 0xf8, 0x24, 0x20, 0x90, 0x47, 0x01, 0x34, 0xf7, 0xe7, 0xbd, 0xe8, 0x38, 0x40, 0x00, 0xf0, 0x08, 0xb9, 0x80, 0x4b, 0x00, 0x20, 0x80, 0x4b, 0x00, 0x20, 0x80, 0x4b, 0x00, 0x20, 0x80, 0x4b, 0x00, 0x20, 0x80, 0x4b, 0x00, 0x20, 0x80, 0x4b, 0x00, 0x20, 0x80, 0x4b, 0x00, 0x20, 0x80, 0x4b, 0x00, 0x20, 0xa4, 0xcb, 0x00, 0x20, 0xf8, 0xb5, 0x1a, 0x4b, 0x0e, 0x46, 0x1a, 0x49, 0x1c, 0x5c, 0x0b, 0x5c, 0x00, 0x2b, 0x2b, 0xd0, 0x18, 0x4f, 0x19, 0x4a, 0x37, 0xf8, 0x10, 0x70, 0x52, 0xf8, 0x23, 0x50, 0x00, 0x21, 0x38, 0x46, 0x0a, 0x46, 0x00, 0xf0, 0xaf, 0xf8, 0x28, 0x46, 0x21, 0x46, 0x0e, 0xb9, 0x32, 0x46, 0x17, 0xe0, 0x02, 0x2e, 0x07, 0xd1, 0x00, 0x22, 0x00, 0xf0, 0x4d, 0xf8, 0x38, 0x46, 0x20, 0x21, 0x4f, 0xf4, 0x80, 0x72, 0x08, 0xe0, 0x03, 0x2e, 0x0a, 0xd1, 0x00, 0x22, 0x00, 0xf0, 0x43, 0xf8, 0x38, 0x46, 0x20, 0x21, 0x4f, 0xf4, 0x00, 0x72, 0xbd, 0xe8, 0xf8, 0x40, 0x00, 0xf0, 0x5f, 0xb8, 0x01, 0x22, 0xbd, 0xe8, 0xf8, 0x40, 0x00, 0xf0, 0x36, 0xb8, 0xf8, 0xbd, 0x00, 0xbf, 0x24, 0x49, 0x00, 0x20, 0xb6, 0x49, 0x00, 0x20, 0x64, 0x49, 0x00, 0x20, 0x50, 0x49, 0x00, 0x20, 0x07, 0x4b, 0x1b, 0x5c, 0x00, 0x29, 0x14, 0xbf, 0x1a, 0x46, 0x00, 0x22, 0x05, 0x49, 0x08, 0x5c, 0x28, 0xb1, 0x05, 0x49, 0x51, 0xf8, 0x20, 0x00, 0x19, 0x46, 0x00, 0xf0, 0x29, 0xb8, 0x70, 0x47, 0x24, 0x49, 0x00, 0x20, 0xb6, 0x49, 0x00, 0x20, 0x50, 0x49, 0x00, 0x20, 0x02, 0x4b, 0x1a, 0x68, 0x42, 0xf0, 0x05, 0x00, 0x18, 0x60, 0x70, 0x47, 0x10, 0xe0, 0x00, 0xe0, 0x02, 0x4b, 0x1a, 0x68, 0x42, 0xf0, 0x02, 0x00, 0x18, 0x60, 0x70, 0x47, 0x10, 0xe0, 0x00, 0xe0, 0x01, 0x4b, 0x01, 0x38, 0x18, 0x60, 0x70, 0x47, 0x14, 0xe0, 0x00, 0xe0, 0x12, 0xf0, 0x01, 0x0f, 0xd0, 0xf8, 0x00, 0x24, 0x00, 0xf5, 0x80, 0x63, 0x14, 0xbf, 0x11, 0x43, 0x22, 0xea, 0x01, 0x01, 0x19, 0x60, 0x70, 0x47, 0x40, 0xf8, 0x21, 0x20, 0x70, 0x47, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0x00, 0x06, 0x4b, 0x53, 0xf8, 0x20, 0x20, 0x06, 0x4b, 0x53, 0xf8, 0x22, 0x00, 0x20, 0xf0, 0x0f, 0x00, 0x01, 0x43, 0x21, 0xf4, 0x40, 0x60, 0x43, 0xf8, 0x22, 0x00, 0x70, 0x47, 0xe0, 0x49, 0x00, 0x20, 0xa0, 0xe0, 0x02, 0x44, 0x00, 0xf0, 0x3f, 0x00, 0x15, 0x4b, 0xb2, 0xf1, 0x80, 0x5f, 0x30, 0xb5, 0x53, 0xf8, 0x20, 0x30, 0x13, 0x48, 0x4f, 0xf0, 0x80, 0x04, 0x0e, 0xd1, 0x02, 0x68, 0x04, 0xfa, 0x03, 0xf4, 0x04, 0xf4, 0xf0, 0x54, 0x14, 0x43, 0x04, 0x60, 0x0f, 0x48, 0x50, 0xf8, 0x23, 0x10, 0x41, 0xf4, 0x40, 0x62, 0x40, 0xf8, 0x23, 0x20, 0x30, 0xbd, 0x05, 0x68, 0x04, 0xfa, 0x03, 0xf4, 0x04, 0xf4, 0xf0, 0x54, 0x25, 0xea, 0x04, 0x04, 0x04, 0x60, 0x07, 0x48, 0x50, 0xf8, 0x23, 0x40, 0x0a, 0x43, 0x24, 0xf4, 0x7c, 0x74, 0x22, 0x43, 0x40, 0xf8, 0x23, 0x20, 0x30, 0xbd, 0x00, 0xbf, 0xe0, 0x49, 0x00, 0x20, 0x44, 0xe1, 0x02, 0x44, 0xa0, 0xe0, 0x02, 0x44, 0x38, 0xb5, 0x0c, 0x46, 0x05, 0x46, 0x20, 0x21, 0x02, 0xb1, 0x10, 0x22, 0xff, 0xf7, 0xc4, 0xff, 0x28, 0x46, 0x21, 0x46, 0xbd, 0xe8, 0x38, 0x40, 0xff, 0xf7, 0xaa, 0xbf, 0x08, 0xb5, 0x10, 0x48, 0x00, 0xf0, 0x36, 0xf8, 0x06, 0x20, 0x01, 0x21, 0x00, 0xf0, 0x52, 0xf8, 0x07, 0x20, 0x01, 0x21, 0x00, 0xf0, 0x4e, 0xf8, 0x08, 0x20, 0x01, 0x21, 0x00, 0xf0, 0x4a, 0xf8, 0x01, 0x21, 0x09, 0x20, 0x00, 0xf0, 0x46, 0xf8, 0x00, 0xf0, 0x1e, 0xf8, 0x00, 0xf0, 0x84, 0xf8, 0xff, 0xf7, 0x72, 0xff, 0x04, 0x48, 0xff, 0xf7, 0x77, 0xff, 0xbd, 0xe8, 0x08, 0x40, 0xff, 0xf7, 0x63, 0xbf, 0x00, 0xbf, 0x00, 0x40, 0x00, 0x20, 0x80, 0x38, 0x01, 0x00, 0x08, 0xb5, 0xff, 0xf7, 0x59, 0xfe, 0xff, 0xf7, 0x5b, 0xfe, 0x03, 0x4b, 0x00, 0x2b, 0xfa, 0xd0, 0xaf, 0xf3, 0x00, 0x80, 0xf7, 0xe7, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x08, 0xb5, 0x00, 0xf0, 0x09, 0xf8, 0xc0, 0xb2, 0x08, 0xbd, 0x00, 0x00, 0x01, 0x4b, 0x18, 0x60, 0x70, 0x47, 0x00, 0xbf, 0x08, 0xed, 0x00, 0xe0, 0xef, 0xf3, 0x10, 0x80, 0x62, 0xb6, 0xbf, 0xf3, 0x4f, 0x8f, 0xbf, 0xf3, 0x6f, 0x8f, 0x70, 0x47, 0x06, 0x4b, 0x18, 0x68, 0x10, 0xf0, 0xff, 0x00, 0x06, 0xd1, 0x05, 0x49, 0x0a, 0x68, 0x12, 0xf0, 0x01, 0x0f, 0x0c, 0xbf, 0x00, 0x20, 0x07, 0x20, 0x70, 0x47, 0x00, 0xbf, 0x0c, 0xd0, 0x02, 0x44, 0x68, 0xfc, 0x02, 0x44, 0x07, 0x4b, 0x53, 0xf8, 0x30, 0x20, 0x02, 0xf1, 0x88, 0x43, 0x03, 0xf5, 0x14, 0x33, 0x1a, 0x68, 0x11, 0x43, 0x19, 0x60, 0x18, 0xb9, 0x03, 0x49, 0x40, 0xf2, 0x04, 0x40, 0x08, 0x60, 0x70, 0x47, 0xe0, 0x4a, 0x00, 0x20, 0x00, 0x50, 0x02, 0x44, 0x05, 0x4b, 0x53, 0xf8, 0x30, 0x00, 0x00, 0xf1, 0x88, 0x42, 0x02, 0xf5, 0x14, 0x33, 0x18, 0x68, 0x20, 0xea, 0x01, 0x01, 0x19, 0x60, 0x70, 0x47, 0xe0, 0x4a, 0x00, 0x20, 0x11, 0x28, 0x82, 0xb0, 0x17, 0xd0, 0x0d, 0x4b, 0x03, 0xeb, 0xc0, 0x00, 0x41, 0x68, 0x01, 0xf1, 0x88, 0x42, 0x02, 0xf5, 0x14, 0x33, 0x18, 0x68, 0x40, 0xf0, 0x01, 0x01, 0x19, 0x60, 0x00, 0x20, 0x01, 0x90, 0x01, 0x9a, 0x0f, 0x2a, 0x02, 0xd8, 0x01, 0x9a, 0x50, 0x1c, 0xf8, 0xe7, 0x18, 0x68, 0x20, 0xf0, 0x01, 0x01, 0x19, 0x60, 0x02, 0xb0, 0x70, 0x47, 0x00, 0xbf, 0xe0, 0x4a, 0x00, 0x20, 0x08, 0xb5, 0x30, 0x4b, 0x30, 0x49, 0x1a, 0x68, 0x42, 0xf4, 0x00, 0x00, 0x18, 0x60, 0x0b, 0x68, 0x2e, 0x48, 0x43, 0xf0, 0x10, 0x02, 0x0a, 0x60, 0x01, 0x68, 0x41, 0xf0, 0x3c, 0x03, 0x03, 0x60, 0x01, 0x21, 0x05, 0x20, 0xff, 0xf7, 0xaa, 0xff, 0x05, 0x20, 0xff, 0xf7, 0xc9, 0xff, 0x05, 0x20, 0x01, 0x21, 0xff, 0xf7, 0xb7, 0xff, 0xff, 0xf7, 0x8f, 0xff, 0x10, 0xb9, 0x24, 0x48, 0x01, 0x22, 0x02, 0x60, 0x24, 0x49, 0x0b, 0x68, 0xda, 0xb2, 0x02, 0x2a, 0x11, 0xd1, 0x22, 0x48, 0x01, 0x68, 0x21, 0xf4, 0x40, 0x63, 0x23, 0xf0, 0x0f, 0x02, 0x42, 0xf0, 0x02, 0x01, 0x01, 0x60, 0x00, 0x68, 0x20, 0xf4, 0x40, 0x63, 0x23, 0xf0, 0x0f, 0x02, 0x1c, 0x48, 0x42, 0xf0, 0x02, 0x01, 0x01, 0x60, 0x1b, 0x4b, 0x1a, 0x68, 0x42, 0xf0, 0x02, 0x01, 0x19, 0x60, 0x53, 0xf8, 0xe0, 0x0c, 0x00, 0xf0, 0x0f, 0x02, 0xe0, 0x3b, 0x01, 0x2a, 0x03, 0xd1, 0x19, 0x68, 0x21, 0xf0, 0x0f, 0x00, 0x18, 0x60, 0x14, 0x4b, 0x1a, 0x68, 0x02, 0xf0, 0x0f, 0x01, 0x01, 0x29, 0x03, 0xd1, 0x18, 0x68, 0x20, 0xf0, 0x0f, 0x02, 0x1a, 0x60, 0x10, 0x4b, 0x19, 0x68, 0x10, 0x4b, 0x1a, 0x68, 0xc1, 0xf3, 0x83, 0x50, 0x0e, 0x28, 0x22, 0xf4, 0x7c, 0x01, 0x0c, 0xbf, 0x41, 0xf4, 0x48, 0x01, 0x41, 0xf4, 0x24, 0x01, 0x19, 0x60, 0x08, 0xbd, 0x64, 0xf0, 0x02, 0x44, 0x18, 0xfc, 0x02, 0x44, 0x6c, 0xe1, 0x02, 0x44, 0x04, 0xf8, 0x02, 0x44, 0xc8, 0xf0, 0x02, 0x44, 0x10, 0xe1, 0x02, 0x44, 0x14, 0xe1, 0x02, 0x44, 0x84, 0xe1, 0x02, 0x44, 0xa8, 0xe0, 0x02, 0x44, 0x78, 0xdc, 0x02, 0x44, 0xb0, 0xf0, 0x02, 0x44, 0x00, 0x00, 0x08, 0x20, 0x10, 0x40, 0x10, 0x40, 0x80, 0x04, 0x08, 0x40, 0x02, 0x02, 0x80, 0x01, 0x00, 0x80, 0x02, 0x10, 0x00, 0x00, 0x00, 0x04, 0x20, 0x08, 0x10, 0x00, 0x40, 0x02, 0x01, 0x01, 0x80, 0x20, 0x80, 0x10, 0x02, 0x00, 0x01, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00, 0x50, 0x00, 0x40, 0x00, 0x60, 0x00, 0x40, 0x00, 0x70, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x03, 0x00, 0x02, 0x00, 0x3c, 0x00, 0x3a, 0x00, 0x04, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0e, 0x00, 0x36, 0x00, 0x14, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x07, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x3b, 0x00, 0x39, 0x00, 0x3a, 0x00, 0x3e, 0x00, 0x34, 0x00, 0x3f, 0x00, 0x31, 0x00, 0x10, 0x00, 0x0f, 0x00, 0x3b, 0x00, 0x3d, 0x00, 0x11, 0x00, 0x14, 0x00, 0x3f, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 0x01, 0x04, 0x02, 0x03, 0x00, 0x04, 0x03, 0x04, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x04, 0x02, 0x01, 0x04, 0x03, 0x01, 0x01, 0x04, 0x04, 0x02, 0x04, 0x02, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00 }; unsigned int blink_len = 2944; void setup() { Serial.begin(9600); SerFlash.begin(); pinMode(RED_LED, OUTPUT); Serial.println("Opening"); SerFlash.open("/sys/mcuimg.bin", FS_MODE_OPEN_WRITE); SerFlash.del("/sys/mcuimg.bin"); SerFlash.open("/sys/mcuimg.bin", FS_MODE_OPEN_WRITE); SerFlash.write(blink, blink_len); SerFlash.close(); digitalWrite(RED_LED, HIGH); Serial.println("Reset to load new binary image"); } void loop() { } Quote Link to post Share on other sites
Vitry 0 Posted January 23, 2015 Share Posted January 23, 2015 Hi, I am able read and write flash. it works fine. BUT when i restart the module flash getting erased. can anybody face same problem? my code is here #include <SLFS.h> #include <SPI.h> #include <WiFi.h> #include <ccRTC.h> #include <Wire.h> #define SETTINGS_FILE_NAME "flashFile.txt" #define SETTINGS_FILE_SIZE 512 uint8_t flash_max_buffer[512]; void setup() { // put your setup code here, to run once: Serial.begin(9600); SerFlash.begin(); serialFlash_readAll(SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE); for(uint16_t r= 0;r < 512;r++){ Serial.print(flash_max_buffer[r]); flash_max_buffer[r] = 10; Serial.print(" "); if(r%20 == 0){ Serial.println(" "); } } serialFlash_writeAll(SETTINGS_FILE_NAME, SETTINGS_FILE_SIZE); } void loop() { // put your main code here, to run repeatedly: } void serialFlash_readAll(char * filename, int maxfilesize){ SerFlash.open(filename, FS_MODE_OPEN_READ); SerFlash.readBytes(flash_max_buffer, maxfilesize); SerFlash.close(); } void serialFlash_writeAll(char * filename, int maxfilesize){ SerFlash.open(filename, FS_MODE_OPEN_WRITE); SerFlash.write(flash_max_buffer, maxfilesize); SerFlash.close(); } When i restart for the first time i should be reading 10 but i read 0 every where thanks Quote Link to post Share on other sites
spirilis 1,265 Posted January 23, 2015 Share Posted January 23, 2015 I don't see you "creating" the file anywhere in your code. So the SimpleLink API is probably returning an error somewhere in there and you're not addressing it. Sent from my Galaxy Note II with Tapatalk 4 Quote Link to post Share on other sites
nitred 2 Posted February 2, 2015 Share Posted February 2, 2015 Hi @@spirilis I've been having a few problems with the library/RAM. Scenario: 1) My program is pretty long 2) I have many global variables (approximately 40) 3) I update the global variables in several functions. I usually get data from a UDP or TCP socket and put the data into these variables. 4) I then take the data from the global variables and update a FILE (using your library) # The problem I'm having is that, the moment I read the FILE into my BUFFER, it seems to OVERWRITE a few of my global variables with data from the FILE. Here's a general example : (Please note that my actual code is pretty huge compared to the example. The example is used to illustrate the issue only, and I don't think you'll be able to replicate the issue on this example) uint8_t global_variable = 15; uint8_t flash_buffer[512]; void setup(){ Serial.begin(9600); SerFlash.begin(); Serial.println(global_variable); // >>>>>>>> OUTPUT : 15 SerFlash.open("TEST.txt", FS_MODE_OPEN_READ); // "TEST.txt" is already created with 512 bytes as filesize SerFlash.readBytes(flash_buffer, 512); Serial.println(global_variable); // >>>>>>>> OUTPUT : 0 <<<<<<<< THIS IS THE PROBLEM, I LOSE MY OLD DATA flash_buffer[45] = global_variable; // updating a particular byte in the buffer SerFlash.write(flash_buffer, 512); SerFlash.close(); Serial.println(global_variable); // >>>>>>>> OUTPUT : 0 <<<<<<<< I HAVE DEFINITELY LOST MY OLD DATA } void loop(){ delay(1000); } Here's a few observations: 1) This happens not just to one variable, but several global variables. This is a pretty big issue since I have some global flags that get SET / RESET whenever I have a FILE operation and throws my program out of sync. 2) I'm guessing that I'm on the limit of my RAM usage and when I load 512 new bytes into the "flash_buffer", some of the global variables' addresses get overwritten. I know I have to reduce my RAM footprint but do you have any other Suggestions? 1) Will putting global variables into STRUCTs help? 2) Can I have file sizes of 128 bytes? 3) Could there be an issue with the library itself in terms of offsets and writing to the wrong location? 4) Anything other suggestions to get rid of the problem? Thanks! Quote Link to post Share on other sites
spirilis 1,265 Posted February 2, 2015 Share Posted February 2, 2015 I think you can have small file sizes. Either way you can declare it 512 bytes in the chip and only read/write 128. Second, what kind of MCU? Is this CC3200 or are you using this with a CC3100 + MSP430 or Tiva? I'm a bit puzzled why global variables would get overwritten when you've pre-declared your buffer 512 bytes. The CC3200, if that's what you're using, isn't a small memory footprint either. I can't recall how much space is allocated to stack though. Quote Link to post Share on other sites
nitred 2 Posted February 2, 2015 Share Posted February 2, 2015 I'm working on CC3200. I know it says 256KB of RAM but I'm quite certain all that isn't available for stack or even for program memory because on Energia 13, my program size went upto about 80KB and Energia would complain that I'm over using memory by 8 Bytes. (I had to remove Serial debugs entirely for it to successfully compile). Luckily Energia 14 was released soon and the same program went only up to about 40KB. As to my current program, I went ahead and dropped Serial debugs entirely (including removing Serial.begin), I seemed to have saved about 3KB of program memory (And I'm sure some stack space as well) but the issue persists. I just realized that my buffer is pre-declared when you pointed it out, and it only makes it so much more strange! Any suggestions to fix it and possible causes for the issue please? Any chance I'm looking in the wrong place? It took me a lot of time to find the issue because my code flow seemed pretty OK. The variables seem to change their value right after I call "SerFlash.readBytes". I even tried using "volatile" before the data type of the variable wondering if this is some strange interrupt based issue. Thanks! Quote Link to post Share on other sites
craigfoo 3 Posted September 12, 2015 Share Posted September 12, 2015 I've been working with the SLFS library and it seems that I can read and write files just fine but then I run into a fault. I'm using the CC3200 using the Energia library. I created a file through Uniflash so the firmware has something to read at initial setup. The file looks like this: { "APIUrl":"", "APIKey":"", "Token":"", "DeviceId":"" } I do a read, and parse out the JSON values just fine. When I go to write to the file, it seems to write just fine but then craps out and goes in the FaultISR loop, some kind of hard fault (memory?). I can restart the device and then the file gets read again and this time it has what I wrote to it, which is great but then it goes into the FaultISR loop again. Here is my read and write functions: void readFile() { int readStatus; int ValueReturnedByRead; int n = 0; char *readBuffer = new char[250]; readStatus = SerFlash.open(CONFIG_FILE, FS_MODE_OPEN_READ); Serial.println("Read From File: "); do { ValueReturnedByRead = SerFlash.read(); if (ValueReturnedByRead != -1) { readBuffer[n]= (char) ValueReturnedByRead; Serial.print(readBuffer[n]); n++; } } while (ValueReturnedByRead != -1); Serial.println(); parseJSON(readBuffer, "creds"); delete[] readBuffer; int response = SerFlash.close();// close the file Serial.print("File Close Response: "); Serial.println(response); } void writeFile() { int openok; int filelengthWritten; char *bodyToWrite = new char[250]; DynamicJsonBuffer jsonBuffer; JsonObject& root = jsonBuffer.createObject(); root[wpCredentials[0]] = apiUrl.c_str(); root[wpCredentials[1]] = apiKey.c_str(); root[wpCredentials[2]] = apiToken.c_str(); root[wpCredentials[3]] = deviceId.c_str(); root.prettyPrintTo(bodyToWrite, 250); Serial.println("Start"); Serial.println("The Initial String: "); Serial.println("-----------------------------"); Serial.println(bodyToWrite); Serial.println("-----------------------------"); openok=SerFlash.open(CONFIG_FILE, FS_MODE_OPEN_WRITE); Serial.print("File Opened : "); Serial.println(openok); filelengthWritten = SerFlash.write(bodyToWrite); Serial.print("File length WRITTEN out : "); Serial.println(filelengthWritten); SerFlash.close();// close the file delete[] bodyToWrite; } This is really boggling my mind and any help would be great! Thanks! Quote Link to post Share on other sites
seanhodgins 0 Posted November 22, 2015 Share Posted November 22, 2015 I have a different issue. It seems I'm only able to create a file as large as 56kbytes. Even with the 8mb flash version. If I try to go above 56kb the file does not create/open. I need a file that can be at least 200kb. Anyone experience this? Quote Link to post Share on other sites
sll1966 0 Posted December 9, 2015 Share Posted December 9, 2015 I have been able to successfully implement the read and write from this thread, of a small string of characters. Thank you. I have an html file i want to store in flash, can someone show me how my sketch can read the file from my computer into a string that can then be written using this library (or maybe it can directly read the file itself) ?? P.S. As i was having trouble with the above, i also have started playing with uniflash, Quote Link to post Share on other sites
HarisAhmed 0 Posted January 25, 2016 Share Posted January 25, 2016 Hi, Can anyone tell me how to access the program memory?I am working on Over the Air(OTA) update and I need to access the program memory. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.