The aim of this project is to show case how quickly someone can use the QuickLogic QuickFeather development board, SensiML, Zephyr RTOS and MicroPython platform to stack a semi-AutoML environment for Embedded Systems and constrained memory devices to prototype a domain-specific AI inference from start-to-finish.
We strongly believe that the QuickFeather Development board when harmed with the right resources and operating platforms could go beyond its current reach and can be used by anyone from age 6 to 16+ year. This will make it possible to deploy QuickFeather board within STEAM (Science, Technology, Engineering, Arts and Mathematics) in the hand students, researchers and industries thereby widen its current users base.
Artificial Intelligence is going everywhere from online shopping, recommended systems, generative adversarial used in art, movies and televisions, Alexa is going everywhere with remote door bell, navigators, remote shopping, locations, etc... Its the microcontrollers like the powerful QuickFeather with extra 8MB QSPI that power those AI devices and make them to tick.
QuickFeather just need to be enabled with sensors, dataset(models) and AI algorithms that will make to excel in any constantly changing environment.
The tinyML/TensorFlow Lite library had made it possible to run Al mode and inference on constrained memory devices. In a domain specific AI environment, you don't actually need gigabyte of data since we focus a specific problem domain, we can streamline dataset, prune model to remove irrelevant data, make dataset/model compact and in readiness for embedded systems and constrained memory environments. More about this paradigm later.
MicroPython + Zephyr RTOS + QuickFeather = = AI-on-STEAM
Most developer are put off by Collate-Modify-Compile-Inference repetitions that plague AI development platform.
Won't be nice to script your AI platform in real-time as changes are requires?
For example can you fine-tuning your dataset/model with having to rebuild your algorithms and then re-flashed your QuickFeather board?
Can you incrementally script your dataset/model to incorporate e.g. more corpus without having to rebuild, re-trained, adding more epochs and start all over again and again.
Okay! What about for an end-to-end where QuickFeather had been used in a product. The environment personnel using the board is out on experimentation field trip. He/She will like to fine tune and adjust dataset model already running on on QuickFeather board but then a gotcha is happening here. The office Lab is over 300 miles from experimentation field. This is no joke since nothing is working because the device operation and performance are fixed
QuickFeather Unboxing:
The Eagle has arrived, today I received my QuickFeather Shrink wrapped so we need to reveal box's content and get it ready for exploration and tinkering. Cant wait to get the Mojo working!
Getting Started: with QuickLogic QuickFeather. Yes! We have lots of quick in our words and that is what we do for perfection, I hope you are not envying us. Right!
STEP-1: Setting Development Environment(Kitchen and Sink)
Overview:Getting Started:In this section, I will show and discuss the necessary preparation that was needed to get all the toolchains, build-essential, compilers, MCU flasher,
With every hardware tinkering, bring the embedded device to live there lies its software that will make it to tick, follow instructions set either in high level syntax or on the low level like assembly or machine language. In this project we will stick to high level programming but may need to dive lower as situation permits.
We do want want to achieve in this section of our work? Well we want to setup our software toolchains as shown below:
Operating System: All works are being carried out on X86 dell server running Ubuntu Linux 20.04 LTS. I believe most steps outline below will also work on other Linux environment like Centos, Fedora and MacOS with little or no modifications.
MicroPython + Zephyr RTOS + QuickFeather = = AI-on-STEAM
Toolchains:1.) Build-Essential:In order to get MicroPython to compile on our development platform, we need some build tools and compilers: gnu make is used to build micropython components, or "gmake" on BSD-based systems. We will also need bash, gcc, and Python 3.3+ available as the commands
On the terminal: type the followings:
sudo apt install build-essential
You should get a series of routines being carried out while the build tools are being downloaded and install on your platform:
It good to check your installed gcc compiler version to make sure that things are working as expected:
type: gcc –version
Now we can proceed to our next task to set up the MicroPython toolchain
2.)MicroPython
In order to get MicroPython ready for the Zephyr RTOS integration, we went through the followings:
from MicroPython GitHub repository, we grab the latest distribution for our use.
Note: I did not clone from the master in order to prevent things break-up due to continuous mode of developments that the master branch is subjected to. But it does mean that you cannot push your work to your GitHub repository, you just need to follow git commands
Since we are currently on a Ubuntu 20.04 Linux box, I went for the.tar file and unzip it ready for the next steps:
open the terminal:
type unzip micropython-1.13..zip then press the enter button
you should see a series of activities showing the file being extracted as shown in the screenshot below:
You will now have a micropython-1.13 folder with all its bell and whistles that packages together our first toolchain for this project.
NOTE: to extract a tar.gz file then you carry out the following commands:
In the console, and where micropython-13.tar.gz file is.
- Type: tar-zxvf micropython-1.13.tar.gz
Using the GitHub edition: you can also clone micropyhton directly from its GitHub repository and checkout the branch that you want. On the console/terminal in your working directory, do the followings:
git clone https://github.com/micropython/micropython.git
git checkout v1.13
git update
Alternatively you could do:
git clone -b v1.13 https://github.com/micropython/micropython.git
As you can see below I have several versions of micropython since I do porting it to different hardware platforms.
📷A snapshot of the its folder contents as a shown here:
We will be working on the ports, drivers, tools and mpy-cross for getting MicroPython ready to work on the Quickfeather board.
The ports folder will house the Zephyr RTOS
3.)Zephyr RTOS:
our next step now is to get zephyr rtos into our working directory as sibling folder to micropython folder. I will do a layout snapshot of how you should set things up later on.
On the terminal type:
sudo apt update
Now install Zephyr's dependencies as follows:
navigate to your zephyr project folder:
Next on the terminal, type the commands below:
sudo apt install --no-install-recommends git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget \
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \
make gcc gcc-multilib g++-multilib libsdl2-dev
Say yes (Y) to the prompt and get more build tools install for you.
Wait and allow the installation to be completed. Zephyr's development tools including cmake, dfu-util, ninja-build gperf, python wheel and utilities will be installed/updated ready for our use.
Note: chack the cmake version to be 3.13.1 or higher:
cmake –version
Our next incarnation is to install zephyr build manager => west
So on terminal, type:
pip3 install --user -U west
You should end up with a similar screenshot below:
Next add it to your user profile/environment path:
echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc
source ~/.bashrc
Now check to make sure that west build toolchain is in your system path. Type the following on the console:
west --version
you should greeted with following west version reply:
The above screenshot show that zephyr west build tool is installed and ready for use. We will be using it to generate boiler-plate, initialise project templates, compile, flash, package, update our zephyr developments.
Lets move on:
Now we need to checkout zephyr code for our developments. We will be using version v2.5.0 which happened to be latest at the time of this project but feel free to use any version of your choice. Also you can multiple zephyr project since west will put all those in their virtualised environments. So there should be no issues.
To checkout version v2.5.0 code then do one of the followings in the terminal:
if this your first zephyr project then you could issue the following command:
$ west init zephyrprojectqf -m https://github.com/zephyrproject-rtos/zephyr --mr v2.5.0
The above will download zephyr code from the GitHub with v2.5.0 branch for you.
It may take few minutes to even an hour depends on your internet connection and bandwidth but you will have something similar to the screenshot below:
as you can see from the above screenshot, the green text message ask you to run => west update inside your newly created zephyrprojectqf folder.
Note: I used zephyrprojectqf (qf for QuickFeather board)
If you already have zephyrproject previously installed then:
cd zephyrproject/zephyr
git checkout v2.5.0
west update
This mean you don't have to redo the Zephyr installation to just switch from master to a tagged release, you can instead do:
$ cd zephyrproject/zephyr
$ git checkout v2.5.0
$ west update
Note:- keep everything in lower case hey! :)
- zephyrprojectqf folder is only for zephyr source code, main.c, etc..
- micropython-1.13 folder is our port and serves as our application that we are linking (interface ffi ) with zephyr rtos.
Let move on again:
Next navigate into zephyrprojectqf:
issue the => west update command
Wait while the project is being updated:
you will see among others the quicklogic hal (hardware abstration layer) getting update as well:
we are on a good path for now, lets stick to that for the rest of the project.
Now we need to configure our environment in readiness for our quickfeather board. We source => zephyrprojectqf/zephyr/zephyr-env.sh
snapshot of zephyr-env.sh showing some of the environmental variables
Also below is a snapshot of an extract from west.yml which can be customised for specific development of Zephyr usage.
There is an option to install Zephyr's SDK or not since our primary line is that of hybrid RTOS and firmware. Please note that both Micropython and Zephyr RTOS can be standalone, they can work without each other but we wanted to combine the best of these two worlds and exploit their features in our project.
Finger cross here but if we have to install the sdk anywhere in this project then we will do that without any reserve.
As you can see my reluctance since zephyr sdk gobble up to an almost 1GB in compressed format. Things started to get filling up fast in space then we think. As of time of this project, the latest SDK was v0.12.4 It can be retrieve on your Linux box as stated below or access it via GitHub:
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.12.4/zephyr-sdk-0.12.4- x86_64-linux-setup.run
After retrieving the SDK, execute the following commands to have setup for your project:
chmod +x zephyr-sdk-0.12.4-x86_64-linux-setup.run
./zephyr-sdk-0.12.4-x86_64-linux-setup.run -- -d ~/zephyr-sdk-0.12.4
Holy cow! Wait for it to finish setting up, it will moow gigabyte of spaces. It would have been nice to be able to select what is needed per a project.
Now that we got most of the toolchains installed for our project, we can carryout the followings:
- Next we will build zephyr for QuickFeather board
- We will then create its BSP configuration file for Micropython
- follow on, we build that micropython port
There will be some fine-tuning being carried out along the way. My experience show that memory layout, linker parameters, etc… may need for patching up done. Since QuickFeather is close to AdaFruit feather board, then we may borrow that board BSP as template for our own use.
More hardware hacks is here to stay! Hey!
Spin-up:Lets do a quick spin-up hello-world of QuickFeather board just to get the board setup and in readiness for our exploration around our project proposal. I mean what we propose to do and cover on the project page at Hackster.io
Let build a build sample that is shipped with Zephyr RTOS. Open the terminal and make sure you are in zephyrprojectqf/zephyr folder.
Next source the environment for zephyr-env.sh
Now enter the following commands to build the sample hellow_world:
west build -b quick_feather samples/hello_world
NOTE: if you have problems building the sample application stated above then:
error says => e.g. ModuleNotFoundError: No module named 'elftools'
1.) from project root, try/run:
pip3 install --user -r /zephyrprojectqf/zephyr/scripts/requirements.txt
several python tools and wheels will be downloaded and installed on your platform.
You should now be able to build the sample hello_world using the commandsas shown below here:
west build -b quick_feather samples/hello_world
Add zephyr SDK to udev rules list:
We then proceed to flash the QuickFeather board as being stepped out below:
connect the board through a micro-usb 2.0 to our computer
press the reset button and then press the user button to put the board in programming mode:
But wait, this is not going to happen without Quicklogic SDK installation. This will be another toolkit and toolchains requirements to our bag of tools. Without the SDK we wont be able to flash our zephyr rtos and micropython onto the quickfeather board. Its the only toolkit in our bag as of current until zephyr flashing tool called “west” is extended to work with quickfeather.
Next we carried the following steps on the terminal:
clone the quicklogic qorc-sdk onto our Ubuntu platform:
git clone --recursive https://github.com/QuickLogic-Corp/qorc-sdk
the above commands will download quicklogic sdk from Github for our local usage.
Next we then we need to download the ARM gcc toolchain for our systems. As of witing of this project, the link is as given below:
Go there and download the one we are using here is:
📷📷
we need to extract the tarball we download from above:
The toolchain was extracted and installed into /usr/share/ folder as shown below here:
The toolchain environmental path variable was added to the.bashrc permanently.
export PATH=/usr/share/gcc-arm-none-eabi-10-2020-q4-major/bin/:$PATH
📷📷
now source the.bashrc file: source ~/.bashrc
Our next hundle is to install the “Gateway” note: we are dealing with FPGA here so roll up your sleeve:
since we are going to doing some stuff with QuickLogic Symbiflow, so we think it will be nice to get it setup along the way. Also I have been always interested in learning some FPGA fundamental but never get around it, plus Xilinx, Verilog systems are always ask for gigabyte of storage that always put me off but here we are, what took me so long.
Okay form the Symbiflow documentation, I need another:
Ram Size: 2 GB or moreFree Hard-Disc space: 5GB or more
to be taken up from my systems storage and memory, isn’t this lovely made from hardware description language?
The Github installation steps are a bit confusing and intermixed but I went for installer mode instead of compiling from source. I always love to compile things from source to gain more knowledge of things are done.
First we download the installer from https://github.com/QuickLogic-Corp/quicklogic-fpga-toolchain/releases/download/v1.3.1/Symbiflow_v1.3.1.gz.run
we then make a copy of this into the /opt directory. This is the one that we will be installing for our project and installation directory will /opt
cd /opt
export the installation directory:
export INSTALL_DIR="/opt/sybiflowv131"
Note: v131 for version control and to keep things a bit tidy and no brain surgery on what versions is being used. This is my working style.
Next we run the bash commands for getting the installer to run:
bash Symbiflow_v1.3.1.gz.run
the above steps are as shown in the extracted screenshot below:
the installer will checkout some github repositories, some are in recursive mode and carry all the installation scripts it has in it.
Note: if you are installing in a privileged area like mine above then you need to be sudo. So run the bash command with sudo okay! Close and re-opened your terminal and repeat those steps again.
I eventually move everything into my compilers folder under the quicklogic directory I created earlier. At least all the project resources can be in one-place.
After a bit of hicups, directory and path issues, I get the working as shown in the screenshot below:
the final result gave a mixed success and conda not being found output messages as shown below.
The wheels were built for fasm but last line above says conda command not found on line 38. So I am going to see if compiling from source will ease things out here? Finger cross!
Note: instructions at https://github.com/QuickLogic-Corp/quicklogic-fpga-toolchain readme is a bit mixed up:
Line 2 export command above is referring to source compilation (GitHub clone) directive and not the installer mode. Took me a while having my hair pulling up!
Notice: the (base) on the terminal last line. This show that conda activate venv is working.
In order to get the previously export command working, I clone the Github from: https://github.com/QuickLogic-Corp/symbiflow-arch-defs.git
I followed the steps outline on the repository to compile that source code.
This is just to make sure that no path or tool left untouched or incomplete. Zephyr’s route and porting is our main driving force here.
The Flash Programmer:
Getting TinyFPGA Programmer ready for use:
following the link and steps outline here:
https://github.com/QuickLogic-Corp/TinyFPGA-Programmer-Application
I needed to install the Quro-SDK and most especially the TinyFPGA to get my project somewhere that will make it possible to flash Zephyr rtos on quickfeather board. So this a round robin routines since “west” zephyr flash programmer cannot do this bit, at least for now.
First we clone the TinyFPGA repository as given below:
git clone --recursive https://github.com/QuickLogic-Corp/TinyFPGA-Programmer-Application.git
next we do an installation of the package
cd TinyFPGA-Programmer-Application
next run:
pip3 install tinyfpgab
I don't know if this is happen on the folder or not since pip is pulling from PyPi repository but later study shows that this is GUI interface to the flash programmer. We are getting there and closer.
Oh! We also need Putty on our Linux box, lets get that out of the way now. On the terminal do the following commands:
sudo apt-get install putty -y
Okay! We have it done already, no problems
TESTs Carried out:Baremental Tests on QuickFeather Board
These tests are important part of my knowing and working with quickFeather evaluation board. It not only serve me on how to circumvent around the bottle neck of getting zephyr rtos on this board but could open up other avenues on how to flash, run and debug it.
Basically I am following these tutorial as laid on the quickFeather board manual and on Github repository. Please refer to those resources for extensive details on steps outline below here!
Test #1a:We compiled the first example code and make it for flashing onto the board.
- cd qorc-sdk/qf_apps/qf_helloworldsw/GCC_Project
- make
bot steps went well as shown on screenshot below:
as you can see, it builds and conversion of ELF to BIN were made.
Note: We will also need to convert zephyr output to quickFeather format, then upload to the board via here (since “west” can handle this)
Next press the quickFeather board rest button once the blue LED will start to flash
Now press ‘user button’ while blue LED is flashing. LED will switch to a mode where green LED is breathing.
Run => lsusb on the terminal
you see list of the devices connected to your computer:
one of them will be either:
Bus 002 Device 029: ID 1d50:6140 OpenMoko, Inc.
or
Bus 002 Device 029: ID 1d50:6130 OpenMoko, Inc.
next edit ~/.bashrc file and add the following line to it:
alias qfprog="python3 /PATH/TO/BASE/DIR/TinyFPGA-Programmer-Application/tinyfpga-programmer-gui.py"
in our case its:
alias qfprog="python3 /home/sanyaade/Compilers/quicklogic/TinyFPGA-Programmer-Application/tinyfpga-programmer-gui.py"
Note: do not forget to: source ~/.bashrc
to quickly test to see if it is working, type qfprog –help on your terminal. You should the help as shown below:
if there is any error like I have e.g. no serial tools then do the followings:
pip3 install apio
apio drivers –serial-enable
Also please note as experience shows in this project and on GitHub issues, I have to pip uninstall serial, then do: python3 -m pip install pyserial (following PySerial readthedocs) but these steps and the above did not solve that issue until I install the esptool folloing the steps from here:
https://github.com/espressif/esptool
git clone https://github.com/espressif/esptool.git
cd esptool
pip install --user -e.
I was then able to proceed to the next hurdle, test the tinyFPGA help line
qfprog -h
when I was greeted with below screenshot:
This is just the way the song goes in hardware tinkering world. Enjoy it!
I unplug and plug back my quickFeather board again
next put your quickFeather in flashing mode:
press reset button (Blue flashing LED)
then followed by user button (Green flashing LED)
With green LED breathing, program qf_helloworldsw app into QuickFeather: from same directory on terminal run the command below:
dmesg | grep tty
You get the port at which your QuickFeather is attached. As you can see from the above screenshot, my was on ttyACM0 (like COM1 on Windows)
Now run the sample hello-world that was compiled previously from the qorc-sdk folder:
qfprog --port /dev/ttyXX --m4app output/bin/qf_helloworldsw.bin
replace the above command with your own port e.g.
qfprog --port /dev/ttyACM0 --m4app output/bin/qf_helloworldsw.bin
running the above commands generate a mode type error:
So what is the correct syntax/command?
qfprog --port /dev/ttyACM0 --mode m4 --m4app output/bin/qf_helloworldsw.bin
now we able to programming the quickFeather board as shown in the screenshot below:
Our next step is to test this out. We also wanted to tryout other example before we embark on our main route back to zephyr but time is really running out on us here!
First-test:
After programming has completed, reset the QuickFeather board but do not press the user button!
A run on putty terminal (port: ttyACM0, baudrate: 115200, serial) gave us the below screenshot where we do few test on the board:
extracts from the Github and user manual PDF we did the following on the terminal to interact with the board:
Test
Output
1. ) Type diag red and you should see the red LED on QuickFeather light up
2.) Type help and you should see:
3.) Type diag to enter the diag sub-menu:
this is very useful but I hope we will be able to port all the ‘C’ code to micropython so that kids can use these functions interactively e.g. type red to on the red LED, etc…
You should see
We will try one more example before we switch our attention to zephyr porting side of things.
We will examine lesson 1B as outline from the GitHub repository but we wont touch the FPGA for now but return back to it toward the end of the report.
Being abel to modify and adpt sample code is important to us so we are taking a drive on lesson 1B below here:
we open the main.c of the just run program in our text editor:
inside that file we change the line:
dbg_str(“\n\nHello world !!\n\n”);
to: dbg_str( "\n\nQuickFeather Run Test Making Things Talk!!\n\n");
/*==========================================================
* Copyright 2020 QuickLogic Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*==========================================================*/
/*==========================================================
*
* File : main.c
* Purpose: main for QuickFeather helloworldsw and LED/UserButton test
*
*=========================================================*/
#include "Fw_global_config.h" // This defines application specific charactersitics
#include <stdio.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "timers.h"
#include "RtosTask.h"
/* Include the generic headers required for QORC */
#include "eoss3_hal_gpio.h"
#include "eoss3_hal_rtc.h"
#include "eoss3_hal_fpga_usbserial.h"
#include "ql_time.h"
#include "s3x_clock_hal.h"
#include "s3x_clock.h"
#include "s3x_pi.h"
#include "dbg_uart.h"
#include "cli.h"
#include "fpga_loader.h" // API for loading FPGA
#include "gateware.h" // FPGA bitstream to load into FPGA
extern const struct cli_cmd_entry my_main_menu[];
const char *SOFTWARE_VERSION_STR;
/*
* Global variable definition
*/
extern void qf_hardwareSetup();
static void nvic_init(void);
int main(void)
{
SOFTWARE_VERSION_STR = "qorc-sdk/qf_apps/qf_helloworldsw";
qf_hardwareSetup();
nvic_init();
S3x_Clk_Disable(S3X_FB_21_CLK);
S3x_Clk_Disable(S3X_FB_16_CLK);
S3x_Clk_Enable(S3X_A1_CLK);
S3x_Clk_Enable(S3X_CFG_DMA_A1_CLK);
load_fpga(axFPGABitStream_length,axFPGABitStream);
// Use 0x6141 as USB serial product ID (USB PID)
HAL_usbserial_init2(false, false, 0x6141); // Start USB serial not using interrupts
for (int i = 0; i != 4000000; i++) ; // Give it time to enumerate
dbg_str("\n\n");
dbg_str( "##########################\n");
dbg_str( "Quicklogic QuickFeather LED / User Button Test\n");
dbg_str( "SW Version: ");
dbg_str( SOFTWARE_VERSION_STR );
dbg_str( "\n" );
dbg_str( __DATE__ " " __TIME__ "\n" );
dbg_str( "##########################\n\n");
dbg_str( "\n\nQuickFeather Run Test Making Things Talk!!\n\n"); // <<<<<<<<<<<<<<<<<<<<< Change me!
CLI_start_task( my_main_menu );
/* Start the tasks and timer running. */
vTaskStartScheduler();
dbg_str("\n");
while(1);
}
static void nvic_init(void)
{
// To initialize system, this interrupt should be triggered at main.
// So, we will set its priority just before calling vTaskStartScheduler(), not the time of enabling each irq.
NVIC_SetPriority(Ffe0_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(SpiMs_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(CfgDma_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(Uart_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
NVIC_SetPriority(FbMsg_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY);
}
//needed for startup_EOSS3b.s asm file
void SystemInit(void)
{
}
we save the above file and recompile the program again.
Next reset the board and then put it in flashing mode:
preset reset button followed by user button (no hard reset here baby!)
I always allow the flashing green light to run for few seconds when in flashing mode. I found the board responding very well with less uploading time.
Next program the modified program onto the board:
qfprog --port /dev/ttyACM0 --mode m4 –m4app output/bin/qf_helloworldsw.bin
press the reset button once to put the board in running mode:
there it is, what took us so long:
Our next step is now to get zephyr rtos running on the board. I take a short break for coffee, soda water and smoked fish (no beer or larger okay!)
There is no documentation on how to flash Zephyr RTOS onto QuickFeather board. Zephyr documentation refer people to QuickFeather board manual using Segger J-Link Adapter (Expensive kit: will cost my Arms and Legs).
Due to my interest in this project I had to order a cheaper type from China, takes almost 35 days to arrive due to Covid-19 lockdown, custom this custom that but it did eventually arrived at my door step. Huh!
A hook up of the debugger with Quickfeather board is as shown below:
Note: J1 and J7 on the board must be shunted
Now we need to install J-Link software for our platform. I am on Ubuntu Linux 20.04 server edition.
Go to: https://www.segger.com/downloads/jlink/#J-LinkSoftwareAndDocumentationPack
I downloaded the version for my Ubuntu 64bit OS:
This has to be installed using dpkg -i command. Good luck!
For OpenOCD software, the following commands was used to set it up on Ubuntu 20.04:
sudo apt-get install openocd
This will download and setup openOCD for us.
Next step is to play around the J-Link to learn how to use it for our Zephyr porting for QuickFeather board.
TEST-DRIVES:
Zephyr binary code was compile and uploaded to QuickFeather board. I was nervous, finger cross and shaken!
As you can see the flash went very well, actually was very fast since this is a basic binary firmware, no bells and whistles currently.
Gotcha! While we are able to flash zephyr binary onto QuickFeather, the board was not booting or running the binary. See below screenshot for port error, lsusb show that openMoko not listed
and dmesg | grep tty did show that we have the quickFeather connected:
1.) what if we configure Zephyr build for QuickFeather to build a binary by default
Propose Solution: modify (zephyr/boards/arm/quick_feather/Kconfig.defconfig) as shown below:
# QuickLogic Quick Feather board
# Copyright (c) 2020 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0
if BOARD_QUICK_FEATHER
config BUILD_OUTPUT_BIN
default y
config BOARD
default "quick_feather"
endif # BOARD_QUICK_FEATHER
NOTE: This should build zephyr image as bin file for us
if the above did not then we need a way of coverting.elf to.bin. We can use ARM objcopy utility to do this sort of things.
Next Solution: I went and tried out objcopy utility:
arm-none-eabi-objcopy -S -O binary zephyr.elf qfzephyr.bin
the resulting outcome was as shown below:
I then reset the QuickFeather, put it flashing mode (user button pressed) and upload our newly converted qfzephyr.bin.
The board was then reset:
I needed to consult both Zephyr and QuickLogic documentation to see what I am getting wrong here. Looks like I need to write at an address/regions or to efpga + mcu mode.
APPENDIX A:
Resource Links:GitHub repository for code, library, framework used in this project:
https://github.com/sanyaade-teachings/ML4Kids
https://github.com/sanyaade-teachings/ML4Kids-docs
https://github.com/sanyaade-teachings/qorc-sdk (contains mods pull-request soon!)
https://github.com/sanyaade-teachings/zephyr ((contains mods with MicroPython pull-request soon!)
=======================================================================
NOTE:This project will continue beyond this competition due to my established interest
Regards!
Sanyaade
=======================================================================
Comments