Comentários em: Extensão C para MicroPython em Raspberry Pi Pico https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/ Fri, 24 May 2024 07:36:44 +0000 de hora em hora 1 https://wordpress.org/?v=7.0 Por: Dr_Phil https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/#comment-21214 Fri, 24 May 2024 07:36:44 +0000 https://picockpit.com/raspberry-pi/?p=774#comment-21214 I followed all the instruction and ended up with a built facfib.mpy file. I used
ARCH = armv6m
When loaded into the Pico I get this error:

ValueError: incompatible .mpy file

My Pico requires the following mpy values:
mpy version: 6
mpy sub-version: 2
mpy flags: -march=armv6m

Checking the first two bytes of the file give version 6 and sub-version 6.
Is there a way to correct this please?

]]>
Por: Adam https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/#comment-18235 Fri, 09 Feb 2024 09:22:45 +0000 https://picockpit.com/raspberry-pi/?p=774#comment-18235 Em resposta a Paulo.

Thank you for the information, Paulo!

]]>
Por: Paulo https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/#comment-18221 Fri, 09 Feb 2024 01:44:59 +0000 https://picockpit.com/raspberry-pi/?p=774#comment-18221 Now you can compile to armv6 so just change this line in the Makefile and no need to change the micropython code
ARCH = armv6m

I had a few errors compiling the factfib.c, where are the fixes:

// missing the ” in the end.
#include “py/dynruntime.h”

// convert the return value to mp_obj_t
STATIC mp_obj_t factorial(mp_obj_t x_obj) {
mp_int_t x = mp_obj_get_int(x_obj);
mp_int_t rslt = factorial_helper(x);
return mp_obj_new_int(rslt);
}

]]>
Por: paopao69 https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/#comment-9539 Wed, 22 Mar 2023 17:59:43 +0000 https://picockpit.com/raspberry-pi/?p=774#comment-9539 Em resposta a Lynggaard.

Did you eventually get it to work?

]]>
Por: Lynggaard https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/#comment-5438 Dom, 08 Jan 2023 20:09:41 +0000 https://picockpit.com/raspberry-pi/?p=774#comment-5438 I tried to do the above, but various things dont work out as described:

– I followed the instructions above, got micropython, modified the makefile as described
– I do make (but I get a factfib.native.mpy file instead of factfib.mpy)
– I copy the factfib.native.mpy file to the pico as factfib.mpy
(I tried rshell but I got a “timed out or error in transfer to remote: b””, but I could copy it over using Thonny)
– I can import the module (in thonny or rshell – the same) without errors
– I try and run the “ff.fibonacci(5)” but then I get:

“Traceback (most recent call last):
File “”, line 1, in
AttributeError: ‘module’ object has no attribute ‘fibonacci'”

What do I do wrong?

]]>
Por: XMC.pl https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/#comment-1048 Wed, 01 Jun 2022 03:31:26 +0000 https://picockpit.com/raspberry-pi/?p=774#comment-1048 How to configure joomla that can retrieve the data from mysql?

]]>
Por: framboesa raspi https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/#comment-245 Sábado, 27 Nov 2021 17:56:48 +0000 https://picockpit.com/raspberry-pi/?p=774#comment-245 Em resposta a PeterB.

Thank you for your feedback 🙂

]]>
Por: PeterB https://picockpit.com/raspberry-pi/pt/c-extensao-por-micropiton-on-raspberry-pi-pico/#comment-218 Sex, 26 Nov 2021 08:29:10 +0000 https://picockpit.com/raspberry-pi/?p=774#comment-218 Apart from the error in the c program it worked a treat. Thanks.

STATIC mp_obj_t factorial(mp_obj_t x_obj) {
mp_int_t x = mp_obj_get_int(x_obj);
mp_int_t rslt = factorial_helper(x);
return mp_obj_new_int(rslt);
}

]]>