Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Building with BOARD=GPY has max firmware image size ~2MB

    Scheduled Pinned Locked Moved Discussion
    4 Posts 3 Posters 46 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • techykermitT Offline
      techykermit
      last edited by

      Hi there!

      We are trying to compile down our code and flash it on our devices, eventually with SecureBoot. I have encountered an interesting thing in this process though. Running the following commands:

      #In pycom-micropython-sigfox
      cd esp32
      #Download our firmware
      echo "Downloading Firmware..."
      cd frozen/Base
      git clone -b "production" https://github.com/XXXX/XXXX.git
      mv firmware/* . #Move the downloaded firmware into the Base directory
      echo "Firmware downloaded and unpacked."
      cd ..
      cd .. #Move back to base dir
      make BOARD=GPY clean
      make V=1 BOARD=GPY TARGET=boot #Add V=1 for extra debugging
      make BOARD=GPY TARGET=app
      make BOARD=GPY flash
      

      gives an error on the last one, when trying to flash the image:
      2031856 bytes => Firmware size exceeds available space 2027520 on board

      This sounds strange in my ears, since the GPy is supposed to have 8MB of external flash according to the specsheet? The code can be flashed onto the device using Visual Studio Code (non-frozen using PyCom's plugin) without getting any size-related errors.

      Is the approach to extracting frozen code wrong, or is there something that is done wrong here, hence the size-related errors?

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron @techykermit
        last edited by

        @techykermit the flash partition layout splits the total available flash between the boot loader, 2 copies of the firmware (for secure OTA), the “NVRAM” data and the file system.

        Can’t find the current layout right away, but I wouldn’t be surprised if there were about 2 MB for each of the firmware partitions and 4 for the file system or something similar.

        It’s possible to adjust the partition layout (to reduce the file system for instance), but that requires you to fully erase the whole flash. I believe that should be somewhere in the files in esp32/boards/GPY.

        1 Reply Last reply Reply Quote 2
        • techykermitT Offline
          techykermit
          last edited by

          Bumping this since we've kind of hit a point where the raw Python code on the device is bigger than the ~2MB limit, making further development troublesome unless the issue is solved. @jcaron, I first want to apologize that I didn't thank you last year for replying and giving some pointers:)) I looked into the source and there are multiple files there: https://github.com/pycom/pycom-micropython-sigfox/tree/Dev/esp32/boards/GPY. Which one would be the one to edit? The structure doesn't seem very clear to me. You gave an example of that it's possible to reduce the file system - is it possible to grow it? And I assume after changing where the partitions end, I can just build it normally? Would changing the sizes alter previously generated encryption keys for the device, or can I use the same keys for signing the firmware? And with "fully erasing the whole flash", I assume you mean using something like PyCom's firmware update tool CLI with this option:

          $ pycom-fwtool-cli -h
          
              erase_all           Erase entire flash!
          [...]
          
          robert-hhR 1 Reply Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @techykermit
            last edited by

            @techykermit You have to increase the partition sizes. There are two places which you have to change in the tools directory.:
            a) tools/size_chk.sh: line 14 has the limit for the image size.
            b) tools/script_8MB: That is the template for the partition table. Each entry contains the start and the size. Note that otadata sits between the factory and ota_0 partitions.

            If you change the partitions, the file system will have to be rebuilt.

            I do not know whether the encryption keys are affected. But there is a good chance that changing the partitions does not affect the encryption keys.

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post

            Pycom on Twitter

            Pycom