I had similar problems, here you find my way for solving these I made a hour counter using UI-Flow. When i test it using the run button of UI-Flow it works fine, but when i try downloading the program to the m5stack it also freezes. After adding more program code, the testing also fails because the py-code where re-sorted by UI-Flow and some procedures where located at the end and are not reachable for the main loop. After manually sorting the procedures in a correct order the program runs fine again but downloading is again not possible. The cause of this behaviour is that UI-Flow stores the complete blockly-file (.m5f-file-type) in addition to the py-code to the m5stack. Therefore i used vs-code to transfer the py-code directly to the m5stack without the blockly-file and the program runs. My conclusions for big programs: they will be resorted by UI-Flow in a unexpected manner they can't download with UI-Flow, i belive the cause is located in a memory limitation but they can be transferred by using vs-code, to do this see also the m5stack video: https://www.youtube.com/watch?v=Y9pOWgsNgKk