ROBOTC file system

Well, don’t know what to tell you, there are limitations (see earlier posts in this thread #8 and #10) and this code is a bit of a hack, but I did test using V3.63 and the demo code was working correctly with a small number of files. How many files did you write? How are you checking the contents?

How to reverse engineer, well, couple of techniques. The file management dialog provides a table of contents dump, that gives some useful information. Doing a memory dump (ie. reading the whole flash using a command line tool) adding a file using the ROBOTC dialog, do another memory dump and then compare before and after also gives information. Knowing how a simple file system like this has been implemented in other systems also helps, I have 30 years experience in writing embedded (and other) software so most of these implementations can be compared to things from the past.

1 Like

My apologies. I did not realize I was operating on ROBOTC V. 3.62. I now have ROBOTC V. 3.63. I did set the value of every element in the array to the same value. The good thing is that all the characters in the saved file (data file) are of the same character. However, I changed the value of the elements of the array and the new file was a replica of the previous file from the first test. (firmware was re-downloaded before each test). However I would like to note that I did have success in saving phrases and words to a file successfully (Ex. “robot” and “thats_cool”). I’ll play around with it a little more, I have a feeling that the flash is not being completely cleared when I am re-downloading the firmware. Once again thanks for your help, learning a lot from this!

1 Like

Well I found the problem! The problem was I had to simply power cycle the cortex. A simple but important step!:smiley:

I must say everything is going quite well with this flash library. I have created a coding system where each port/device is assigned a character. These characters are then followed by a decimal number that is -999,999 < x < 999,999 (I created a romanizing function for this). The recording data program also only writes the elements to the file that are not NULL so the data file doesn’t take up as much space. Now that I have this recording file done, I am currently working on a program to decode the file and create a .h or .c autonomous file. I’ll tell y’all how well it works (accuracy of autonomous being copied) once I am done. Once again, thanks for all the help with this!

Sorry for reviving such an ancient thread, but it seems like bClearVariablesOnPgmStart=false allow you to do everything a flash storage library could do. Am I missing something?

This flag, when true, clears all of the global variables in RAM to 0 when the program starts. If you were to set this to false then the global variables would retain their values each time the program is started as long as you have not turned off the cortex or restarted the ROBOTC virtual machine. In normal use there would never be a reason to set this flag to false. No matter how this flag is set, ROBOTC will clear all global variable memory to 0 when the cortex is first turned on.

This thread dealt with the topic of using the ROBOTC file system to retain information even when the cortex was turned off.

1 Like