QuecOpen Introduction

QuecOpen is originally meant for OpenLinux modules of Quectel: EC2x, AG35 modules where end-user can program their own application run along with the Quectel processes. I would like to share my thought and development guide with QuecOpen SDK.

Qualcomm MDM 9x07 Block Diagram

There are some thing you need to know about this QuecOpen approach:

  • Linux kernel is 3.18 which is very old LTS kernel. If your application requests to intergrate a new brand new peripheral then there could be troublesome to let the kernel device driver can be backward compatible with kernel 3.18
  • Free flash memory is about 20MB for rootfs and 100MB for userdata partition. So those devices are not for application which require large file system or replace completely your external MPU
  • Total RAM 100MB for everything, so pls take this into your consideration
  • Limited application notes from manufacture: due to complexity and Qualcomm agreement and lack of Linux RD resource, available application notes are limited and does not really describe

QuecOpen SDK

QuecOpen SDK is not published, there are some internal processes to approve QuecOpen SDK for specific customers who have RD resource to build their own application based on QuecOpen modules. Thus, you need to talk to your local FAE or sales to discuss about this.

  • Root filesystem is generated one, so you do not need to create the filesystem again, however it will limit your project flexibility if you want to intergrate more packages, ... and also want to maintain
  • Linux kernel 3.18 is provided with sources and closed libs

How SDK is looked like:

$ tree -L 2
.
|-- Makefile
|-- ql-ol-crosstool
|   |-- autogen-env.sh
|   |-- ql-ol-crosstool-env-init
|   |-- relocate_sdk.py
|   |-- scripts
|   |-- site-config-armv7a-vfp-neon-oe-linux-gnueabi
|   |-- sysroots
|   `-- version-armv7a-vfp-neon-oe-linux-gnueabi
|-- ql-ol-extsdk
|   |-- LICENSE.md
|   |-- example
|   |-- include
|   |-- lib
|   `-- tools
|-- ql-ol-kernel
|   |-- AndroidKernel.mk
|   |-- COPYING
|   |-- CREDITS
|   |-- Documentation
|   |-- Kbuild
|   |-- Kconfig
|   |-- MAINTAINERS
|   |-- Makefile
|   |-- README
|   |-- REPORTING-BUGS
|   |-- android
|   |-- arch
|   |-- block
|   |-- crypto
|   |-- drivers
|   |-- firmware
|   |-- fs
|   |-- include
|   |-- init
|   |-- ipc
|   |-- kernel
|   |-- lib
|   |-- linaro
|   |-- mm
|   |-- net
|   |-- qconfig
|   |-- samples
|   |-- scripts
|   |-- security
|   |-- sound
|   |-- tools
|   |-- usr
|   `-- virt
|-- ql-ol-rootfs
|   |-- WEBSERVER
|   |-- bin
|   |-- boot
|   |-- build.prop
|   |-- cache
|   |-- data
|   |-- dev
|   |-- etc
|   |-- firmware
|   |-- home
|   |-- lib
|   |-- linuxrc -> /bin/busybox
|   |-- media
|   |-- mnt
|   |-- persist
|   |-- proc
|   |-- run
|   |-- sbin
|   |-- sdcard -> /media/card
|   |-- share
|   |-- sys
|   |-- system
|   |-- target
|   |-- tmp
|   |-- usr
|   |-- usrdata
|   |-- var
|   `-- www
|-- ql-ol-rootfs.tar.gz
`-- ql-ol-usrdata
    `-- Readme

59 directories, 22 files
EC21EFAR06A01M4G_OCPU_01.001.01 SDK

Supported Modules

  • EC2x Series (EC21, EC25) variants: -E, -A, -J, -AU, -AUT, -KL, -EU
  • Automotive module: AG35

QuecOpen Development with Docker

Prepare

  1. Install docker for your machine
  2. For MacOS, pls config NFS share for nfsd with macos_setup_nfs.sh script, so you could take advantage of read/write access compare to Mac FS driver.

Usage for Linux users

  1. Pull the docker image
docker pull bacnh85/quectel-quecopen
  1. Create docker container that point to your working directory
docker run -d --name quectel-quecopen \
 -e PUID=`id -u` -e PGID=`id -g` -v 
 "$(pwd)":/opt bacnh85/quectel-quecopen
  1. Start the container shell to start build your application, the rootfs, kernel, ...
docker exec -it -u `id -u` quectel-quecopen /bin/bash

Docker Compose

Sample docker-compose.yml is provided for more convenience.

version: '3.4'
services:
  quectel-quecopen-dev:
    image: bacnh85/quectel-quecopen
    container_name: quectel-quecopen
    environment:
      - PUID=501
      - PGID=20
    volumes:
      - "./:/opt"
    tty: true

Then, power up the container:

docker-compose up -d

Login to the contailer shell:

docker exec -it -u `id -u` quectel-quecopen /bin/bash

Usage for macOS users

Due to OSX driver performance is not that good, a good approach is using NFS share. Thus, docker-compose file is more convience to start with.

Before doing it, you need to config nfsd to share your current working directory to docker container, pls refer to macos_setup_nfs.sh

docker-compose -f docker-compose_macos.yml up -d

Then, login to the container to start:

docker exec -it -u `id -u` quectel-quecopen /bin/bash

QuecOpen Development Guide

There are more example at QuecOpen Example repo so I will demonstrate development steps with simple helloworld application.

Requirements

In order to play with samples, there are some consumptions:

  • EC2X QuecOpen SDK from your local Quectel contact
  • Ubuntu machine running LTS Ubuntu 14.04 or 16.04 or 18.04
  • EC2X module is flashed with firmware which is same prefix name with the SDK number. In this guide, I will use EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001_SDK.tar.bz2 for SDK and base FW EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001.zip
  • Able to use ADB to communicate with the module

Clone the repo

Clone the repo with --recursive param, so it could also clone the submodule:

git clone --recursive https://github.com/bacnh85/Quectel_EC2x_QuecOpen_Examples.git
cd Quectel_EC2x_QuecOpen_Examples

Step 1: Upgrade base firmware

In order to work with QuecOpen, the module needs to be flashed with QuecOpen base firmware EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001.zip.

Note: the SDK and the base firmware must be matched

  • Base firmware: EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001.zip
  • SDK: EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001_SDK.tar.bz2

Step 2: Install driver and extract SDK

  1. Install driver and test ADB

Suggested dev environment is: Ubuntu LTS 18.04 or 16.04.

In order to support all futher Quectel modules, it is suggested to install drivers and configure the system to recognize ADB port. Follow the instruction in folder `Quectel_Module_ADB_Issue'. This is the most important step.

Now, you should see the device with command: adb devices, and also see 4 serial ports:

  • /dev/ttyUSB0 - DM port for upgrade firmware and get the device log
  • /dev/ttyUSB1 - get NMEA message output
  • /dev/ttyUSB2 - for AT command communication
  • /dev/ttyUSB3 - for PPP connections or AT communication

You also able to login to the device using:

adb shell

SDK Copy the SDK and extract:

cp /path/EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001_SDK.tar.bz2 .
tar xjvf EC21EFAR06A01M4G_OCPU_BETA1112_01.001.01.001_SDK.tar.bz2

Folder structure:

tree -L 2
.
|-- EC21EFAR06A01M4G_OCPU_01.001.01.001.zip
|-- EC21EFAR06A01M4G_OCPU_01.001.01.001_SDK.tar.bz2
|-- Quectel_EC2x_QuecOpen_Examples
|   |-- HelloWorld
|   |-- LICENSE
|   `-- README.md
`-- ql-ol-sdk
    |-- Makefile
    |-- ql-ol-crosstool
    |-- ql-ol-extsdk
    |-- ql-ol-kernel
    |-- ql-ol-rootfs.tar.gz
    `-- ql-ol-usrdata

In order to prepare cross platform environment, please execute this before each build session.

source ql-ol-sdk/ql-ol-crosstool/ql-ol-crosstool-env-init

Step 3: Compile the example

Compile the source

Inside each folder, run bash script or cmake to create Makefile:

cd HelloWorld
sh build.sh

or

cd HelloWorld
mkdir build
cd build
cmake ..
make

Result is in build/ folder.

Run and debug inside QuecOpen

Inside the build directory, copy the program into /usrdata

adb push HelloWorld /usrdata
adb shell

Inside the shell:

cd /usrdata
./HelloWorld

EC2x available resources and notes

Inside EC2x, chipset is Qualcomm 9x07 and application is running on the ARM-Cortex A7. There are 2 available libraries in QuecOpen:

  • Qualcomm dependent libs: located inside ql-ol-extsdk, which are provided by Quectel
  • Standard Linux dependent libs: follow the Linux standard with compiled binary files and header files are located in ql-ol-crosstool/sysroots/. If the application needs extra function which is not yet compiled, user could compile and put into the rootfs

Available resource:

  • RAM: 100MB
  • Flash: Root partition 100MB
  • User partiton: 100MB, is mouted under /usrdata

Current DTS has following peripheral info:

  • SPI6 - /dev/spi
  • I2C-2 - /dev/i2c-2
  • I2C-4 - /dev/i2c-4
  • UART-5 - /dev/ttyHSL1 (disabled by default)
  • UART-2 - /dev/ttyHSL0 (enabled by default; for debug port)
  • UART-6 - /dev/ttyHSL2 (disabled by default; with SPI)
  • UART-3 - /dev/ttyHS0 (enabled by default)

To communicate with the baseband core, use: /dev/smd8

Good luck!