Skip to main content
Visitor II
August 9, 2022
Solved

How to install an example flutter app to STM32MP157F-DK2

  • August 9, 2022
  • 3 replies
  • 4012 views

I`ve built st-image-weston for stm32mp157f-disco board with flutter and clang layer. Then I built SDK with:

bitbake core-image-weston -c populate_sdk

Then I installed SDK with

.tmp/deploy/sdk/core-image-weston-openstlinux-weston-stm32mp15-disco-x86_64-toolchain-4.0.1-snapshot.sh

After that I setup environment with

source /opt/st/stm32mp15-disco/4.0.1-snapshot/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
 
 
export CC=${CLANGCC}
 
export CXX=${CLANGCXX}

My question is how can I install a simple flutter app to my discovery board. What are the steps that I need to follow.

    This topic has been closed for replies.
    Best answer by Joel

    @Gencay​ This is not a simple answer.

    First it depends on what image type you have (runtime=debug, runtime=release, runtime=profile).

    My experience is that running a Flutter app via debug on the STM32MP157F-DK2 is very slow. So I would avoid that for now.

    If you have a runtime=release image, then you have to create an AOT image.

    The steps used by meta-flutter to generate an AOT (release - libapp.so) is located here:

    https://github.com/meta-flutter/meta-flutter/blob/kirkstone/classes/flutter-app.bbclass#L170

    If you install the flutter-engine-<runtime flavor>-sdk-dev package to image, you can scp the engine_sdk.zip from /usr/share/flutter/engine_sdk.zip. This has required gen_snapshot to generate an AOT image.

    So once you have the libapp.so you create your bundle folder on target. This can be in /tmp or wherever you have write access to.

    Create this folder structure on target. data/flutter_assets is from your host build/flutter_assets folder.

    <bundle folder>

    data

    flutter_assets

    lib

    libapp.so

    For DRM run:

    `flutter-pi --release <bundle folder>`

    For Wayland run:

    `flutter-auto --w=1920 --h=720 --b=<bundle folder>

    I may have missed something but that's the general flow. Feel free to start a discussion here so other meta-flutter users can benefit:

    https://github.com/meta-flutter/meta-flutter/discussions

    Cheers,

    Joel

    3 replies

    Technical Moderator
    August 25, 2022

    Hi @Gencay​ ,

    @Community member​ (Kudos to him ! )  share his Flutter project for MP1 here in this community :

    https://community.st.com/s/project/a8g3W000000fxV5QAI/google-flutter-for-stm32mp1

    I'm quite sure this will help you

    Olivier

    JoelAnswer
    Visitor II
    August 25, 2022

    @Gencay​ This is not a simple answer.

    First it depends on what image type you have (runtime=debug, runtime=release, runtime=profile).

    My experience is that running a Flutter app via debug on the STM32MP157F-DK2 is very slow. So I would avoid that for now.

    If you have a runtime=release image, then you have to create an AOT image.

    The steps used by meta-flutter to generate an AOT (release - libapp.so) is located here:

    https://github.com/meta-flutter/meta-flutter/blob/kirkstone/classes/flutter-app.bbclass#L170

    If you install the flutter-engine-<runtime flavor>-sdk-dev package to image, you can scp the engine_sdk.zip from /usr/share/flutter/engine_sdk.zip. This has required gen_snapshot to generate an AOT image.

    So once you have the libapp.so you create your bundle folder on target. This can be in /tmp or wherever you have write access to.

    Create this folder structure on target. data/flutter_assets is from your host build/flutter_assets folder.

    <bundle folder>

    data

    flutter_assets

    lib

    libapp.so

    For DRM run:

    `flutter-pi --release <bundle folder>`

    For Wayland run:

    `flutter-auto --w=1920 --h=720 --b=<bundle folder>

    I may have missed something but that's the general flow. Feel free to start a discussion here so other meta-flutter users can benefit:

    https://github.com/meta-flutter/meta-flutter/discussions

    Cheers,

    Joel

    GencayAuthor
    Visitor II
    September 12, 2022

    I have unzip this file

    /usr/share/flutter/engine_sdk.zip

    , then I have

    engine_sdk/sdk/clang_x64/gen_snapshot 

    directory at the target. After this how can I generate my AOT image?