I am very sorry for such a long time left. I have been thinking about it, but I am not sure if my results wil help You.
You did not specified a type of permanent memory of Yours device. Are You using SD card, QSPI memory or EEPROM memory? Your executable program could be copied there in a same way as a preloader, U-Boot or files of Yours operating system and then simple executed with command via shell.
I know this listen as a stupid question, please, do not be angry with me. I am only trying to get an point of view.
(The very “dummy” solution, in case a compilator is integrated in Yours operating system, could also be transfer source code of Yours program with shell via serial link with ‘echo’ and sign ‘>’ to a target files with compilation them. But it would be really dummy solution .)
Best wishes, Jan Konecny.