Open athusrv opened 4 years ago
Hi athusrv, use link below to understand how to add user c module right into micropython binary https://docs.micropython.org/en/latest/develop/cmodules.html
After that clone this repo on your c module directory and add micropython.mk file inside mpy-qr folder with following content:
UQR_MOD_DIR := $(USERMOD_DIR) SRC_USERMOD += $(addprefix $(UQR_MOD_DIR)/, \ moduqr.c \ ) CFLAGS_USERMOD += -I$(UQR_MOD_DIR) -DMODULE_UQR_ENABLED=1
after that follow micropython docs to build and and flash custom build.
Note: you might get compilation error about re-declared variables. Just find those variables in code and replace them with something else.
I think the above still works, but just now I've pushed some changes that include a micropython.mk
which is what you need to just "drop in" this code as a USER_C_MODULES
of your mpy build.
Hi - I am getting an error - any clues on what I am doing wrong ?
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: /tmp/ccE9bnqF.ltrans1.ltrans.o: in function rendered_qr_del.lto_priv.585': /tmp/wasp-os/wasp/modules/mpy-qr/moduqr.c:272: undefined reference to
free'
/usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: /tmp/ccE9bnqF.ltrans1.ltrans.o: in function rendered_qr_make_new.lto_priv.581': /tmp/wasp-os/wasp/modules/mpy-qr/moduqr.c:155: undefined reference to
malloc'
Full build at - https://pastebin.pl/view/raw/a6a02df3
Trying to build as part of https://github.com/daniel-thompson/wasp-os.git
Confirmed it works with 1.13 source base. But for 1.17 they changed those makefiles to Cmake. So I think it need some changes for that. If you know out-of-box how, it would be easier than again developing wheel.
Well it was not so hard...
Test build based on revision 81f706aee
http://iot.petrkr.net/olab/micropython-1.17-octopus-uqr-20211228.bin
Hi, I've tried to build this for stm32 and nrf port but I was getting same undefined reference
error as @bmsleight.
After digging a bit in micropython py/malloc.c
it turns out that free
and malloc
are undefined and replaced by m_free
and m_malloc
. https://github.com/micropython/micropython/blob/8af9dbbde1fca07371aa13a8276c8e764edac28c/py/malloc.c#L56
So after replacing free
and malloc
both stm32 and nrf ports builds work. I've done a bit of testing and so far module uqr
works great in both. I've not tried to build esp32 port with these changes but I expect it to work too. I will test it ASAP and confirm. 👍🏼
Here is the PR: #3
[UPDATE]: Just tested esp32 port and it works too. 🎉
First of all, thanks for your code. It's been hard to find some code over the internet that can generate QR codes.
I'm new to micropython and I don't know how to turn this into a micropython module. Could you please update your README with that instructions or maybe give me some idea on how I can achieve that?
Thank you!