All Projects → loboris → Kboot

loboris / Kboot

Licence: other
K210 bootloader

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
python
139335 projects - #7 most used programming language
XC
17 projects
CMake
9771 projects
shell
77523 projects

Projects that are alternatives of or similar to Kboot

kocherga
Robust platform-agnostic Cyphal/DroneCAN bootloader for deeply embedded systems
Stars: ✭ 21 (-27.59%)
Mutual labels:  ota, bootloader, firmware-update
Yaota8266
Yet another OTA solution for ESP8266, this time supporting large (>512KB) firmwares even on 1MB devices (repo is rebased)
Stars: ✭ 112 (+286.21%)
Mutual labels:  ota, bootloader
fullmetalupdate
FullMetalUpdate Python client application.
Stars: ✭ 19 (-34.48%)
Mutual labels:  ota, firmware-update
Mikrotik-RouterOS-automatic-backup-and-update
Script sends backups to email and keep your mikrotik firmware up to date.
Stars: ✭ 269 (+827.59%)
Mutual labels:  firmware-update
mandelbrot
Mandelbrot set drawers for vintage hardware
Stars: ✭ 15 (-48.28%)
Mutual labels:  bootloader
Huawei-Bootloader-Unlocker
This little tool let you unlock your bootloader of your huawei family device easily
Stars: ✭ 176 (+506.9%)
Mutual labels:  bootloader
BootProg
FAT12/16/32 Bootsector for .COMs/.EXEs
Stars: ✭ 74 (+155.17%)
Mutual labels:  bootloader
FireLamp JeeUI
Project Fire Lamp based on EmbUI framework (GPL license)
Stars: ✭ 77 (+165.52%)
Mutual labels:  ota
linux-4.x.y
Linux 4.4内核实践分析
Stars: ✭ 72 (+148.28%)
Mutual labels:  bootloader
face-mask-detection-tf2
A face mask detection using ssd with simplified Mobilenet and RFB or Pelee in Tensorflow 2.1. Training on your own dataset. Can be converted to kmodel and run on the edge device of k210
Stars: ✭ 72 (+148.28%)
Mutual labels:  k210
esp32-ota
ESP32 OTA based on ThingsBoard Open-source IoT Platform
Stars: ✭ 45 (+55.17%)
Mutual labels:  ota
ESP8266-Hobo-Clock
Self adjustable ESP8266 clock without RTC and NTP
Stars: ✭ 24 (-17.24%)
Mutual labels:  ota
mbr-boot-manager
💾 Master Boot Record with a boot menu written in Assembly
Stars: ✭ 57 (+96.55%)
Mutual labels:  bootloader
munet
Network WiFi access, OTA, NTP time and MQTT (via PubSubClient) for ESP8266 and ESP32
Stars: ✭ 20 (-31.03%)
Mutual labels:  ota
UEFI-Boot
Boot Linux directly from UEFI firmware (without any bootloader)
Stars: ✭ 38 (+31.03%)
Mutual labels:  bootloader
CloverEFI-4MU
Manually install Clover EFI Bootloader via Linux System on Legacy BIOS or UEFI Firmware.
Stars: ✭ 93 (+220.69%)
Mutual labels:  bootloader
bfloader
🧠 Brainfuck IDE and interpreter in 512 bytes. (boot sector)
Stars: ✭ 41 (+41.38%)
Mutual labels:  bootloader
mTower
mTower is Trusted Execution Environment specially designed to be used on MicroController Units (MCUs) supporting ARM TrustZone technology (e.g., Cortex-M23/33/35p). mTower operates well under restrictions typical for such environment – small RAM and ROM sizes, relatively low performance, absence of rich OSes providing variety of services availab…
Stars: ✭ 34 (+17.24%)
Mutual labels:  bootloader
uefi-elf-bootloader
UEFI ELF Bootloader example
Stars: ✭ 40 (+37.93%)
Mutual labels:  bootloader
stm32bl
STM32 MCU serial firmware loader (jet another stm32loader fw bootloader tool)
Stars: ✭ 22 (-24.14%)
Mutual labels:  bootloader

Kboot

Kboot is a small applications which enables loading and executing applications from any K210 SPI Flash location.

It can be used to implement firmware upgrade (OTA) or to load different (multiple) applications based on some criteria.

Interactive mode is also provided which enables the user to select which application to load and execute from the list of stored applications.


More details about Kboot are available in the Kboot.md.



How to build

Clone the repository or download and unpack the repository zip file.

The repository contains all the tools and sources needed to build Kboot.

The same build prerequisites must be satisfied as for building any other K210 application.

Default application (config.bin, which runs if no configured aplications are found), default configuration sector (config.bin) and 3 example applications are provided.

Example applications:
MicroPython.bin, built with FreeRTOS SDK is expected to be found at Flash address 0x00080000 (512 KB),
dvp_ov.bin, Standalone SDK example, is expected to be found at Flash address 0x00280000 (2.5 MB)
maixpy.bin, built with Standalone SDK, is expected to be found at Flash address 0x00280000 (2.5 MB)

You can flash the default application executting:

./ktool.py -p /dev/ttyUSB0 -a 65536 -b 2000000 -t default.bin

You can flash one of example aplications executing:

./ktool.py -p /dev/ttyUSB0 -a 524288 -b 2000000 -t MicroPython.bin
./ktool.py -p /dev/ttyUSB0 -a 2621440 -b 2000000 -t dvp_ov.bin
./ktool.py -p /dev/ttyUSB0 -a 2621440 -b 2000000 -t maixpy.bin

Build from source

  • Change the working directory to the build directory.
  • A simple build script BUILD.sh is provided which builds the Kboot application.
  • Simply execute BUILD.sh
  • kboot.kfpkg package will be created which includes bootloader_lo.bin and bootloader_hi.bin binaries and the default configuration.

Flash to K210 board

kboot.kfpkg can be flashed to the K210 using the included ktool.py.
Note: Do not use standard kflash.py, kboot binaries requires flashing 4KB aligned blocks, which is not supported by standard kflash.py.


Examples

Build the Kboot package:

boris@UbuntuMate:/home/kboot/build$ ./BUILD.sh

 ===========================
 === Building bootloader ===
 ===========================

=== Running 'cmake'
=== Running 'make'
Scanning dependencies of target kendryte
[ 25%] Linking C static library libkendryte.a
[ 25%] Built target kendryte
Scanning dependencies of target bootloader_lo
[ 75%] Building C object CMakeFiles/bootloader_lo.dir/src/bootloader_lo/main.c.obj
[ 75%] Building ASM object CMakeFiles/bootloader_lo.dir/src/bootloader_lo/crt.S.obj
[100%] Linking C executable bootloader_lo
Generating .bin file ...
[100%] Built target bootloader_lo

=== Finished
---------------------------------------------------
   text	   data	    bss	    dec	    hex	filename
    496	    112	      8	    616	    268	bootloader_lo
---------------------------------------------------

=== Running 'cmake'
=== Running 'make'
Scanning dependencies of target kendryte
[ 14%] Linking C static library libkendryte.a
[ 14%] Built target kendryte
Scanning dependencies of target bootloader_hi
[ 28%] Building ASM object CMakeFiles/bootloader_hi.dir/src/bootloader_hi/crt.S.obj
[ 71%] Building C object CMakeFiles/bootloader_hi.dir/src/bootloader_hi/main.c.obj
[ 71%] Building C object CMakeFiles/bootloader_hi.dir/src/bootloader_hi/fpioa.c.obj
[ 71%] Building C object CMakeFiles/bootloader_hi.dir/src/bootloader_hi/gpiohs.c.obj
[ 85%] Building C object CMakeFiles/bootloader_hi.dir/src/bootloader_hi/sha256.c.obj
[100%] Linking C executable bootloader_hi
Generating .bin file ...
[100%] Built target bootloader_hi

=== Finished
--------------------------------------------------
   text	   data	    bss	    dec	    hex	filename
   6848	   1264	     88	   8200	   2008	bootloader_hi
--------------------------------------------------

=== Creating 'kboot.kfpkg'

--------------------------------------------------------------------
To flash the kboot package to K210 run:
./ktool.py -p /dev/ttyUSB0 -b 2000000 -t kboot.kfpkg

To flash default application run:
./ktool.py -p /dev/ttyUSB0 -a 65536 -b 2000000 -t default.bin

Default config can run applications from 512K or 2.5M flash address
Some applications are provided for testing:

To flash MicroPython (FreeRTOS SDK) at 512K, run:
./ktool.py -p /dev/ttyUSB0 -a 524288 -b 2000000 -t MicroPython.bin
To flash dvp_ov (Standalone SDK) at 2.5M, run:
./ktool.py -p /dev/ttyUSB0 -a 2621440 -b 2000000 -t dvp_ov.bin
To flash maixpy (Standalone SDK) at 2.5M, run:
./ktool.py -p /dev/ttyUSB0 -a 2621440 -b 2000000 -t maixpy.bin

If no app is found, default app will be run which blinks the LED(s).
--------------------------------------------------------------------

boris@UbuntuMate:/home/kboot/build$ 

Flash Kboot package to K210 board:

boris@UbuntuMate:/home/kboot/build$ ./ktool.py -p /dev/ttyUSB0 -b 2000000 -t kboot.kfpkg
[INFO] COM Port Selected Manually:  /dev/ttyUSB0 
[INFO] Default baudrate is 115200 , later it may be changed to the value you set. 
[INFO] Trying to Enter K210 ROM ISP Mode... 
.
[INFO] Automatically detected dan/bit/trainer 

[INFO] ROM ISP detected, loading 2nd stage ISP 
[INFO] ISP loaded in 0.921s 
[INFO] Starting 2nd stage ISP at 0x805e0000 
[INFO] Wait For 0.1 second for ISP to Boot 
[INFO] 2nd stage ISP ok 
[INFO] Selected Baudrate: 2000000 
[INFO] Baudrate changed, greeting with ISP again ...  
[INFO] 2nd stage ISP ok 
[INFO] Initialize K210 SPI Flash 
[INFO] Flash initialized successfully 
[INFO] Flash ID: 0xC86018, unique ID: 384130323209302A, size: 16 MB 
[INFO] Extracting KFPKG ...  
[INFO] Writing bootloader_lo.bin to Flash address 0x00000000 
[INFO] Flashing firmware block with SHA suffix 
Programming BIN: |=========================================================================================================| 100.0% 
[INFO] Flashed 645 B [1 chunks of 4096B] (00000000~00000FFF) in 0.137s 
[INFO] Writing bootloader_hi.bin to Flash address 0x00001000 
[INFO] Flashing firmware block with SHA suffix 
Programming BIN: |=========================================================================================================| 100.0% 
[INFO] Flashed 8149 B [2 chunks of 4096B] (00001000~00002FFF) in 0.255s 
[INFO] Writing config.bin to Flash address 0x00004000 
Programming DATA: |=========================================================================================================| 100.0% 
[INFO] Flashed 4096 B [1 chunks of 4096B] (00004000~00004FFF) in 0.132s 
[INFO] Writing config.bin to Flash address 0x00005000 
Programming DATA: |=========================================================================================================| 100.0% 
[INFO] Flashed 4096 B [1 chunks of 4096B] (00005000~00005FFF) in 0.129s 
[INFO] Rebooting...
 
--- forcing DTR inactive
--- forcing RTS inactive
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

K210 bootloader by LoBo v.1.4.1

* Find applications in MAIN parameters
    0: ' dvp_ov example', @ 0x00280000, size=77248, app_size=1679808, App ok, NOT ACTIVE
    1: '    MicroPython', @ 0x00080000, size=1744896, app_size=1789952, App ok, ACTIVE
    2: '         maixpy', @ 0x00280000, size=1681856, app_size=1679808, App ok, NOT ACTIVE

Select the application number to load [ 0, 1, 2, d=default ] ? 1

* Loading app from flash at 0x00080000 (1789952 B)
* Starting at 0x80000000 ...

M (37678) [K210_MAIN]: Default flash configuration set

RISC-V Kendryte --------------------------------------------- 
 _    _   _____   _   ______    ___   ___   ______   _     _  
( )  / ) (___  ) ( ) (  __  )  (   \ /   ) (  __  ) ( )   ( ) 
| |_/ /   ___| | | | | |  | |  | |\ \ /| | | |__| |  \ \_/ /  
|  _ )   ( ____) | | | |  | |**| | \_/ | | |  ____)   \   /   
| | \ \  | |___  | | | |__| |  | |     | | | |         | |    
(_)  \_) (_____) (_) (______)  (_)     (_) (_)         (_)    
------------------------------------------------------------- 
MicroPython-FreeRTOS by LoBo v1.11.12 (two MPY tasks)
-----------------------------------------------------

MicroPython 1.11.12 (1abe503-dirty) built on 2020-01-02; Sipeed_board with Kendryte-K210
Type "help()" for more information.
>>> 
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].