FreeDOS support

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: FreeDOS support

Post by pohmelie » Wed Nov 25, 2015 9:00 am

dhylands wrote:

Code: Select all

#define MICROPY_NLR_SETJMP (1)
Yeah, I have tried this before, but it looks like djgpp can't preprocess(?) *.S files, since errors are same and irrelevant to value of MICROPY_NLR_SETJMP. So I have just comment this file.
After two hours I successfully built micropython for dos, and test it on my board with AMD Geode and last FreeDos. On a way to build this I have found some «errors» in master of micropython (e.g. different types of arguments in header and source). I will summarize they later and post here, maybe some of them is just my bad understanding. Also there is some issue with build-djgpp(?) since there two directories with djgpp binaries: one contain long names, another short. Second one does not include all binaries (e.g. size) so this should be fixed or I missed something again.
Anyway, build is done and it is time to extend it via dos-specific modules, so where can I read about micropython objects and functions for c↔python bridge? Or source files is enough to realize?
By the way, it looks like there is only "sys" module. How to check what I have?
Hm, can't attach file since it is too large (317Kb-zipped) :lol:

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: FreeDOS support

Post by dhylands » Wed Nov 25, 2015 10:09 am

You can play games in the makefile too. Like this: https://github.com/dhylands/micropython ... kefile#L14

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: FreeDOS support

Post by pfalcon » Wed Nov 25, 2015 1:33 pm

I will summarize they later and post here, maybe some of them is just my bad understanding.
At https://github.com/micropython/micropython/issues please.
Also there is some issue with build-djgpp(?) since there two directories with djgpp binaries: one contain long names, another short. Second one does not include all binaries (e.g. size) so this should be fixed or I missed something again.
It's not clear what you mean. Please mind that any computer system consist of multiple components, for each of which a different party is responsible. We'll be happy to make any reasonable changes to make MicroPython easily buildable with djgpp, but any djgpp issues you would need to report to djgpp project. (FreeDOS issues to FreeDOS, etc.)
Or source files is enough to realize?
Yes, the source is the best reference. You can also search/read this forum, as various aspects were discussed/answered here. But that likely will take you more time than reading source directly, while still
risking that information will be outdated. Reading the source frees from all the issues - you see directly what it is and how it works, it's up to date, etc. And yep, if you read the forum, you'll find people generally praise source quality of uPy, so it of course take you couple of days to figure out it all, but after half an hour of looking you'll know something already.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: FreeDOS support

Post by pohmelie » Wed Nov 25, 2015 9:35 pm

dhylands wrote:You can play games in the makefile too. Like this: https://github.com/dhylands/micropython ... kefile#L14
This does not work, also I found that MICROPY_NLR_SETJMP in mpconfigport.h does not affect on make of nlrx86.S at all. It looks like nothing from mpconfigport.h is defined when preprocessing nlrx86.S. But __i386__ looks defined. Maybe this is djgpp issue.
Done https://github.com/micropython/micropython/issues/1647
pfalcon wrote:It's not clear what you mean.
Of course it's djgpp issue, I've already create https://github.com/andrewwutw/build-djgpp/issues/10 right after posting my previous post.

Little changes to core files, so micropython can be compiled with djgpp:
1. Comment content of nlrx86.S
2. Comment in modmath.c:
131: MATH_FUN_1(gamma, tgamma)
235: { MP_OBJ_NEW_QSTR(MP_QSTR_gamma), (mp_obj_t)&mp_math_gamma_obj },
It looks like there is no tgamma in djgpp std lib.
3. asmx86.c and asmx86.h like here https://github.com/micropython/micropython/issues/1647
Use attached crapy-magic freedos folder :P
Attachments
freedos.zip
(87.94 KiB) Downloaded 241 times

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: FreeDOS support

Post by dhylands » Wed Nov 25, 2015 9:46 pm

pohmelie wrote:
dhylands wrote:You can play games in the makefile too. Like this: https://github.com/dhylands/micropython ... kefile#L14
This does not work
OK - it works fine for me. Maybe you've got a typo or you put it in the wrong place in the Makefile?
also I found that MICROPY_NLR_SETJMP in mpconfigport.h does not affect on make of nlrx86.S at all. It looks like nothing from mpconfigport.h is defined when preprocessing nlrx86.S. But __i386__ looks defined. Maybe this is djgpp issue.
Looking at this again, I think that you need to add -DMICROPY_NLR_SETJMP to CFLAGS and not mpconfigport.h

pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: FreeDOS support

Post by pohmelie » Wed Nov 25, 2015 10:08 pm

dhylands wrote:Looking at this again, I think that you need to add -DMICROPY_NLR_SETJMP to CFLAGS and not mpconfigport.h
Yeah, adding of "CFLAGS_MOD += -DMICROPY_FREEDOS=1" to the Makefile and "#if !defined(MICROPY_FREEDOS) || !MICROPY_FREEDOS" to nlrx86.S solved the problem. 8-)
dhylands wrote:OK - it works fine for me. Maybe you've got a typo or you put it in the wrong place in the Makefile?
Hm, I've just copy your string "PY_O_BASENAME := $(filter-out nlr%, $(PY_O_BASENAME)) nlrsetjmp.o"
Attachments
screenshot.png
screenshot.png (80.41 KiB) Viewed 6699 times

pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: FreeDOS support

Post by pohmelie » Wed Nov 25, 2015 10:09 pm

Oh, I was too fast and did it wrong, of course I should insert "-DMICROPY_NLR_SETJMP" and no changes to nlrx86.S

added:
Yeah, it works fine, so two left: tgamma and asmx86.c/asmx86.h difference

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: FreeDOS support

Post by dhylands » Wed Nov 25, 2015 10:56 pm

Perhaps add

Code: Select all

$(info PY_O_BASENAME = $(PY_O_BASENAME))
before and after the line and see what it did.

What version of make are you using?

Doh - no the problem is that it needs to be after the include of py.mk (which is where PY_O_BASENAME is setup)

pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: FreeDOS support

Post by pohmelie » Thu Nov 26, 2015 7:15 am

dhylands
It does not matter, since "-DMICROPY_NLR_SETJMP" do the job.

pohmelie
Posts: 55
Joined: Mon Nov 23, 2015 6:31 pm

Re: FreeDOS support

Post by pohmelie » Sat Nov 28, 2015 1:57 pm

Finally made FreeDos port without changes to micropython core.
https://github.com/pohmelie/micropython-freedos

Post Reply