• New Updates:

    I am so excited to have MbitV2 in my hand so could not resist to try and run existing tensorflow micro_speech model on microbit.

    I started to look an existing Espruino approach from this post to generate espruino compatible tflite model. I encountered so many issues while convert existing model(hello world/sin wave), creating new model(speach), and even building espruino for mBitV2.

    1 - Convert existing hello_world model

    This code is no longer working with the new notebook.

    import base64;
    print("var model=atob(\""+base64.b64encode(tflite_m­odel)+"\");")
    

    but this works

    import base64;
    print(base64.b64encode(tflite_model))
    
    

    After fixing the base64 stuff, i tried to run the same example in emulator but it neither gives any error nor expected outcome.

    Original example vs Updated example


    2- "Prompt not detected - upload failed" error

    I am getting upload error when trying to upload this code direct to RAM.

    Is this related to Low RAM or Flash??? How can I fix this?

    Connected to Espruino MICROBIT2
    >Execution Interrupted
    New interpreter error:
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Execution Interrupted
    Prompt not detected - upload failed. Trying to recover...
    

    Microbit is flashed this hex

    >process.env
    ={
      VERSION: "2v08",
      GIT_COMMIT: "9a1dd6eb",
      BOARD: "MICROBIT2",
      FLASH: 524288, STORAGE: 40960, RAM: 65536,
      SERIAL: "d80c74c5-75c326d4",
      CONSOLE: "Bluetooth",
      MODULES: "Flash,Storage,hea" ... "opixel,tensorflow",
      EXPTR: 536882360 }
    > 
    
    

    3- Build error.

    To get more space on Microbit I tried to remove 'NEOPIXEL' module from the board file and build make clean && BOARD=MICROBIT2 make.

    But I got errors right after elf file is created

    here is the truncated log

    ......
    ...
    ...
    /mnt/c/Users/ABHINAV.000/Documents/esp/E­spruino/targetlibs/nrf5x_12/components/d­rivers_nrf/hal/nrf_gpio.h:648:22: warning: inlining failed in call to 'nrf_gpio_pin_write': call is unlikely and code size would grow [-Winline]
     __STATIC_INLINE void nrf_gpio_pin_write(uint32_t pin_number, uint32_t value)
                          ^
    targets/nrf5x/jshardware.c:740:9: note: called from here
             nrf_gpio_pin_write(MB_LED_COL2, i&1);
             ^
    /mnt/c/Users/ABHINAV.000/Documents/esp/E­spruino/targetlibs/nrf5x_12/components/d­rivers_nrf/hal/nrf_gpiote.h:322:22: warning: inlining failed in call to 'nrf_gpiote_event_clear': call is unlikely and code size would grow [-Winline]
     __STATIC_INLINE void nrf_gpiote_event_clear(nrf_gpiote_events­_t event)
                          ^
    targetlibs/nrf5x_12/components/drivers_n­rf/gpiote/nrf_drv_gpiote.c:251:5: note: called from here
         nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS­_PORT);
         ^
    targets/nrf5x/jshardware.c: In function 'dly.isra.0':
    /mnt/c/Users/ABHINAV.000/Documents/esp/E­spruino/targetlibs/nrf5x_12/components/d­rivers_nrf/delay/nrf_delay.h:162:22: warning: inlining failed in call to 'nrf_delay_us': call is unlikely and code size would grow [-Winline]
     __STATIC_INLINE void nrf_delay_us(uint32_t number_of_us)
                          ^
    targets/nrf5x/jshardware.c:961:3: note: called from here
       nrf_delay_us((uint32_t)microsec);
       ^
    src/jsutils.c: In function 'jsAssertFail':
    /mnt/c/Users/ABHINAV.000/Documents/esp/E­spruino/targetlibs/nrf5x_12/components/t­oolchain/cmsis/include/core_cm4.h:1790:2­2: warning: inlining failed in call to 'NVIC_SystemReset': call is unlikely and code size would grow [-Winline]
     __STATIC_INLINE void NVIC_SystemReset(void)
                          ^
    src/jsutils.c:374:3: note: called from here
       NVIC_SystemReset();
       ^
    /mnt/c/Users/ABHINAV.000/Documents/esp/E­spruino/targetlibs/nrf5x_12/components/t­oolchain/cmsis/include/core_cm4.h:1790:2­2: warning: inlining failed in call to 'NVIC_SystemReset': call is unlikely and code size would grow [-Winline]
     __STATIC_INLINE void NVIC_SystemReset(void)
                          ^
    src/jsutils.c:374:3: note: called from here
       NVIC_SystemReset();
       ^
    python scripts/check_elf_size.py MICROBIT2 espruino_2v08.93_microbit2.elf
    Testing espruino_2v08.93_microbit2.elf for MICROBIT2
    STORAGE: 442368 -> 483328
    FS DATA: 465824 -> 465840 (16 bytes)
    CODE: 126976 -> 465840 (338612 bytes)
    ==========================
     CODE AND STORAGE OVERLAP
       by 23472 bytes
    ==========================
    make/common/NRF5X.make:440: recipe for target 'espruino_2v08.93_microbit2.app_hex' failed
    make: *** [espruino_2v08.93_microbit2.app_hex] Error 1
    
    
About

Avatar for Abhigkar @Abhigkar started