So I realized embedded development is a whole field in itself. I had been listening to the embedded podcast for years and didn't realize until deep into my embedded programming project that I was entering that whole field unknowingly. They speak of oscilloscopes, debuggers, and all kinds of stuff. I don't have any of that. My goal is to simply code the software for my electronic speed controller microcontroller unit in Dev C++ and have it say things like - cout << "hello world"; ---- as test code to ensure all logic flows well, running it on my windows desktop. Then once it is all finished and perfect I can attempt to run it on the microcontroller by first commenting out all windows specific code and uncommenting out all microcontroller specific code. To do this mass commenting and uncommenting, I realized I could use the "find and replace" command. So for all windows code I use:
/*-*/cout << "initializing microcontroller of ESC nown";
/*-*/system("Pause");
and this acts as a non functioning comment since it only comments out the hyphen but can later be replaced via find and replace command with //-/ instead which will make it act as a actual commented out line.
Then for all microcontroller specific code, it is actually commented out but does so like this:
// Set P1.0/HIN1 latch LOW
//-/P1 &= 0xFE;
note that // Set P1.0/HIN1 latch LOW is a normal comment that will go unchanged between versions but - //-/P1 &= 0xFE; ---- is a actual comment that is distinct from a normal comment since it has -/ after the normal // which means that I can find and replace it with /*-*/ for the microcontroller specific build of the code.
So with just two find and replace commands we can hot swap the whole codebase from microsoft windows runnable version to MCU runnable version. And we can jump back and forth whenever to fix things, test things, run tests on windows and on MCU whenever we want.
/*-*/cout << "initializing microcontroller of ESC nown";
/*-*/system("Pause");
and this acts as a non functioning comment since it only comments out the hyphen but can later be replaced via find and replace command with //-/ instead which will make it act as a actual commented out line.
Then for all microcontroller specific code, it is actually commented out but does so like this:
// Set P1.0/HIN1 latch LOW
//-/P1 &= 0xFE;
note that // Set P1.0/HIN1 latch LOW is a normal comment that will go unchanged between versions but - //-/P1 &= 0xFE; ---- is a actual comment that is distinct from a normal comment since it has -/ after the normal // which means that I can find and replace it with /*-*/ for the microcontroller specific build of the code.
So with just two find and replace commands we can hot swap the whole codebase from microsoft windows runnable version to MCU runnable version. And we can jump back and forth whenever to fix things, test things, run tests on windows and on MCU whenever we want.