|
| 1 | +MicroPython port to the Quectel |
| 2 | +============================= |
| 3 | + |
| 4 | +This is a port of MicroPython to the Quectel series of |
| 5 | +microcontrollers. It uses the HeliosSDK and MicroPython runs as |
| 6 | +a task under FreeRTOS. |
| 7 | + |
| 8 | +Support Eigencomm, Unisoc, Qualcomm and ASR cellular modules. |
| 9 | + |
| 10 | +Supported features include: |
| 11 | +- REPL (Python prompt) over usb. |
| 12 | +- Python 3.4 syntax and built-in rich functional modules. |
| 13 | +- The machine module with GPIO, EXTINT, UART, SPI, ADC, WDT RTC, and Timer. |
| 14 | +- The network module with cellular modem support. |
| 15 | +- etc. |
| 16 | + |
| 17 | +Setting up HeliosSDK and the build environment |
| 18 | +-------------------------------------------- |
| 19 | + |
| 20 | +MicroPython on quectel port requires the HeliosSDK. The HeliosSDK includes the libraries and RTOS needed to |
| 21 | +manage the quectel microcontroller, as well as a way to manage the required |
| 22 | +build environment and toolchains needed to build the firmware. |
| 23 | + |
| 24 | +To install the HeliosSDK the full instructions can be found at the |
| 25 | +[HeliosSDK Development Guide](https://python.quectel.com/doc/Application_guide/zh/helios-sdk/quick-start.html). |
| 26 | + |
| 27 | +**Windows 10 Environment Setup** |
| 28 | + |
| 29 | +*Step 1: Download Toolchain* |
| 30 | + |
| 31 | +Download the toolchain installation package [helios-toolchain.exe](https://github.com/QuecPython/toolchain/releases/tag/V1.4.2) for Windows 10 environment from the QuecPython official website. |
| 32 | + |
| 33 | +*Step 2: Install Toolchain* |
| 34 | + |
| 35 | +Run helios-toolchain.exe as an administrator, as shown in the following figure, and click "**Install**" to install the toolchain. |
| 36 | + |
| 37 | +> The target folder **must not** contain spaces. |
| 38 | +
|
| 39 | +**Ubuntu Environment Setup** |
| 40 | + |
| 41 | +*Step 1: Download Toolchain* |
| 42 | + |
| 43 | +Download the toolchain installation package [helios-toolchain](https://github.com/QuecPython/toolchain/releases/tag/V1.1.0) for Ubuntu 16.04 environment from the QuecPython official website. |
| 44 | + |
| 45 | +*Step 2: Install Toolchain* |
| 46 | + |
| 47 | +Place the installation package in the same location as the target folder. Execute the following command to install the toolchain. |
| 48 | +`sudo ./helios-toolchain` |
| 49 | + |
| 50 | +*Step 3: Install Other Tools* |
| 51 | + |
| 52 | +Enter the following command in the terminal to install `p7zip-full`, `git`, `make`, and `python3`. |
| 53 | +``` |
| 54 | +sudo apt install p7zip-full git make python3 |
| 55 | +``` |
| 56 | + |
| 57 | +*Source Code* |
| 58 | + |
| 59 | +For HeliosSDK, please contact the [QuecPython technical team](https://python.quectel.com/en/contact) for the source code of HeliosSDK(We are preparing to open source), You can also get supports through email QuecPython@quectel.com. |
| 60 | + |
| 61 | +For MicroPython, You can directly pull the official code, but you need to pull MicroPython into the heliossdk directory, for example, create a services directory under heliossdk and place MicroPython in the services directory. |
| 62 | + |
| 63 | +Building the firmware |
| 64 | +--------------------- |
| 65 | + |
| 66 | +Before you start building the firmware, you must build the MicroPython cross compiler firstly, it will be used to pre-compile some of the built-in scripts to bytecode. |
| 67 | + |
| 68 | +> If you are in a Windows environment, you need a Windows compilation toolchain, such as MinGW. |
| 69 | +
|
| 70 | +```bash |
| 71 | +# path: heliossdk/services/micropython |
| 72 | +$ make -C mpy-cross |
| 73 | +``` |
| 74 | + |
| 75 | +Then to build MicroPython for the quectel run: |
| 76 | + |
| 77 | +```bash |
| 78 | +# path: heliossdk/services/micropython |
| 79 | +$ cd ports/quectel |
| 80 | +$ make submodules |
| 81 | +$ make |
| 82 | +``` |
| 83 | + |
| 84 | +This will produce a combined `firmware.a` image in the `build/` |
| 85 | +subdirectory(The compiled MicroPython library will be used by HeliosSDK to build a complete firmware package). |
| 86 | + |
| 87 | +To flash the firmware, you need to fully build the entire firmware package through heliossdk. |
| 88 | + |
| 89 | +*Check the usage of the helios compilation commands* |
| 90 | + |
| 91 | +In the command line started in the HeliosSDK directory, type `helios` and press "**Enter**" to view the usage of the helios command. |
| 92 | +The output is as follows: |
| 93 | + |
| 94 | +``` |
| 95 | +Usage: helios <action> [<app>] [<at>] [<fw_name>] |
| 96 | +
|
| 97 | +These are common commands used in various situations: |
| 98 | + menuconfig - Do the project configuration |
| 99 | + make <app> [[<at>] [<fw_name>]] - Do the compilation work |
| 100 | + private_clean - Clean the app private target |
| 101 | + clean - Clean the output directory |
| 102 | + git [<args>] - Git commands execution |
| 103 | + help - Show this help page |
| 104 | +``` |
| 105 | + |
| 106 | +> For detailed usage of the compilation command, please refer to `README.MD` in the SDK root directory. |
| 107 | +
|
| 108 | +*Compile the firmware* |
| 109 | + |
| 110 | +Taking the EC200UEU_AB module as an example, type the following command in the command line and press "**Enter**": |
| 111 | +``` |
| 112 | +helios make services/micropython @EC200UEU_AB EC200UEUABR03A01M08 |
| 113 | +``` |
| 114 | + |
| 115 | +- `helios`: Trigger the compilation process. |
| 116 | +- `make`: Compile the firmware. |
| 117 | +- `services/micropython`: Application entry address (relative to the SDK root directory, according to the requirements of the host system, the Win32 platform is \ and the Linux platform is /). It can be adjusted according to the specific location of MicroPython. |
| 118 | +- `@EC200UEU_AB`: Specify the target module model. You need to modify it according to your actual model. |
| 119 | +- `EC200UEUABR03A01M08`: Firmware version name, which can be omitted. You need to modify it according to your actual model. |
| 120 | + |
| 121 | +*Check the compilation target* |
| 122 | + |
| 123 | +The generated firmware package is stored in the *`output/release`* folder in the HeliosSDK root directory. |
| 124 | + |
| 125 | +To clean the compilation target, type the following command in the command line and press "**Enter**": |
| 126 | +``` |
| 127 | +helios clean |
| 128 | +``` |
| 129 | + |
| 130 | +*Flash the firmware* |
| 131 | + |
| 132 | +You need to use QPYcom or VSCode tool to burn the firmware. Please refer to [Quectel_QFlash_User_Guide](https://python.quectel.com/doc/Getting_started/en/flash_firmware.html) for firmware flashing. |
| 133 | + |
| 134 | + |
| 135 | +Accessing the board |
| 136 | +------------------------------------- |
| 137 | + |
| 138 | +You can access via the `USB REPL` port, which stands for `Read-Eval-Print-Loop` (interactive interpreter). Please refer to [Quectel_Getting_Started](https://python.quectel.com/doc/Getting_started/en/REPL_dev.html) for firmware debugging. |
0 commit comments