I now this is a unusual request, but I would like to run COBOL on a Micro Controller. The controller I have in mind does provide a C compiler based on LCC, as far as I understand C85.
I do not want to compile on the MC, just run Programs.
So all those nifty things like ncurses, BDB and such are out of question. I need to go as bare as GnuCOBOL could get.
How would I start to compile a Program on windows and keep the C sources to figure out how to compile them for my target?
please advice,
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The first thing you have to do is: get a cross compiler that compiles for this target.
The second thing would be to get GMP for the micro controller, preferably pre-built, otherwise cross-compiled yourself. The last thing would be to generate a libcob by cross-compile.
Once this runs on the controller, the rest is easy.
Last edit: Simon Sobisch 2023-10-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So do you have a "Windows to MC" cross-compiler ready?
If not and it isn't readily available it will likely easier to setup WSL and use a cross-compiler there.
In any case the MC would need to have at least a 32bit C library (or be able to use a static linked one into libcob).
As you've mentioned - there is commonly no need to compile on the MC, but if you want to run it there you either have to get a working libgmp to be used by libcob or adjust GnuCOBOL to not use GMP (possible if for example you adjust it to do everything in PACKED-DECIMAL/native integer - which will limit the number of digits to 38/19, it likely would be most reasonable to just abort where GMP is used, then hack libcob to do the pieces you need, step by step]).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As everything is wrapped within libcob you "only" would need to create that, linking in a static libc and libgmp.
The first big issue is to get the necessary C cross compiler working, the second one is to use that for creating a static libgmp for that target.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Four months are "quite some time" for IT, so @msrobots:
* Is there a C compiler, possibly GCC running on that controller?
* Is there a prebuilt GMP available, if not can you compile that on the controller using the available C compiler?
* Any progress/plans with this project?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK.
I now this is a unusual request, but I would like to run COBOL on a Micro Controller. The controller I have in mind does provide a C compiler based on LCC, as far as I understand C85.
I do not want to compile on the MC, just run Programs.
So all those nifty things like ncurses, BDB and such are out of question. I need to go as bare as GnuCOBOL could get.
How would I start to compile a Program on windows and keep the C sources to figure out how to compile them for my target?
please advice,
Mike
compile options are your friend.
The save all temps option would be best:
Last edit: Mickey White 2023-06-02
The first thing you have to do is: get a cross compiler that compiles for this target.
The second thing would be to get GMP for the micro controller, preferably pre-built, otherwise cross-compiled yourself. The last thing would be to generate a libcob by cross-compile.
Once this runs on the controller, the rest is easy.
Last edit: Simon Sobisch 2023-10-13
So do you have a "Windows to MC" cross-compiler ready?
If not and it isn't readily available it will likely easier to setup WSL and use a cross-compiler there.
In any case the MC would need to have at least a 32bit C library (or be able to use a static linked one into libcob).
As you've mentioned - there is commonly no need to compile on the MC, but if you want to run it there you either have to get a working libgmp to be used by libcob or adjust GnuCOBOL to not use GMP (possible if for example you adjust it to do everything in PACKED-DECIMAL/native integer - which will limit the number of digits to 38/19, it likely would be most reasonable to just abort where GMP is used, then hack libcob to do the pieces you need, step by step]).
sadly this is a quite new MC so neither GCC or GMP is available. Libc is supported as of C85.
So the only way I see is static linking anyways, this will be a interesting excurse
Mike
As everything is wrapped within libcob you "only" would need to create that, linking in a static libc and libgmp.
The first big issue is to get the necessary C cross compiler working, the second one is to use that for creating a static libgmp for that target.
Four months are "quite some time" for IT, so @msrobots:
* Is there a C compiler, possibly GCC running on that controller?
* Is there a prebuilt GMP available, if not can you compile that on the controller using the available C compiler?
* Any progress/plans with this project?