Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
kendryte747 committed Mar 27, 2023
0 parents commit 464fb4a
Show file tree
Hide file tree
Showing 470 changed files with 147,279 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: arduino-k210 documents build and deploy

on:
push:
branches:
- 'main'
paths:
- 'docs/**'
- '.github/workflows/docs.yml'

pull_request:
branches:
- 'main'
paths:
- 'docs/**'
- '.github/workflows/docs.yml'

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Requirements.
run: pip3 install sphinx==5.3.0 sphinx_multiversion sphinx_rtd_theme sphinx-copybutton

- name: Build
run: |
git fetch --unshallow # fetch all history
cd docs && make mhtml
find build -type d -name ".doctrees" | xargs rm -rf
find build -type f -name ".buildinfo" | xargs rm -rf
find build -type f -name "objects.inv" | xargs rm -rf
cd -
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'docs/build'

deploy:
if: ${{ github.ref == 'refs/heads/main' }}
needs: build

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}/main

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
57 changes: 57 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: arduino-k210 core build and autotest, based on ESP32 Arduino CI

on:
push:
branches:
- 'main'
paths-ignore:
- '.github/workflows/docs.yml'
- 'docs/**'

pull_request:
branches:
- 'main'
paths-ignore:
- '.github/workflows/docs.yml'
- 'docs/**'

concurrency:
group: build-${{github.event.pull_request.number || github.ref}}
cancel-in-progress: true

jobs:

build-arduino:
name: Arduino Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Build Sketches
run: |
bash ./tools/on-push.sh
test-arduino-linux:
name: Arduino Test on ubuntu-20.04
runs-on: self-hosted
needs: build-arduino

steps:
- uses: actions/checkout@v3
- name: Build testcases
run: |
bash ./tools/tests_build.sh -c -b canaan_k1 -i 0 -m 1
- name: Run testcases
run: |
bash ./tools/tests_run_simple.sh
- uses: actions/upload-artifact@v3
with:
name: "arduino-test-report-${{ github.sha }}"
path: ${{ github.workspace }}/tests/report/**
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: arduino k210 release based on ESP32 Arduino Release

on:
release:
types: published

jobs:
build:
name: Publish Release
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Build Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash ./tools/on-release.sh
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package/package_k210_index.json
.vscode
build
__pycache__
.pytest_cache
test.log
*.pyc
tests/report
tools/kflash_py
tools/xpack-riscv-none-embed-gcc
Empty file added .gitmodules
Empty file.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Arduino core for K210

[![arduino-k210 github ci, based on ESP32 Arduino CI](https://github.com/kendryte/arduino-k210/actions/workflows/push.yml/badge.svg)](https://github.com/kendryte/arduino-k210/actions/workflows/push.yml) [![arduino-k210 documents build and deploy](https://github.com/kendryte/arduino-k210/actions/workflows/docs.yml/badge.svg)](https://github.com/kendryte/arduino-k210/actions/workflows/docs.yml)

# Install

Use stable release core [package_k210_index.json](https://raw.githubusercontent.com/kendryte/arduino-k210/gh-pages/package_k210_index.json), or Develop core [package_k210_dev_index.json](https://raw.githubusercontent.com/kendryte/arduino-k210/gh-pages/package_k210_dev_index.json)

# Documentation

You can read arduino-k210 online documentation on [github pages](https://kendryte.github.io/arduino-k210/main/)
108 changes: 108 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
menu.clk_freq=CPU Clock Frequency
menu.burn_baudrate=Burn Serial Buadrate
menu.enable_console=Enable Rt-Thread Console
menu.stack_size=Rt-Thread Main Thread Stack Size
menu.enable_only_kmodel_v3=Only Support KMODEL V3

##############################################################
### Boards Start ###
##############################################################

k1.name=Canaan K1

k1.upload.tool=kflash_py
k1.upload.tool.default=kflash_py

k1.upload.maximum_size=6291456
k1.upload.maximum_data_size=6291456
k1.upload.flags=
k1.upload.extra_flags=

k1.serial.disableDTR=true
k1.serial.disableRTS=true

k1.build.core=k210
k1.build.variant=canaan_k1
k1.build.board=CANAAN_K1
k1.build.burn_board=dan

k1.menu.clk_freq.400=400MHz
k1.menu.clk_freq.500=500MHz
k1.menu.clk_freq.600=600MHz
k1.menu.clk_freq.400.build.f_cpu=400000000UL
k1.menu.clk_freq.500.build.f_cpu=500000000UL
k1.menu.clk_freq.600.build.f_cpu=600000000UL

k1.menu.burn_baudrate.1000000=1 Mbps
k1.menu.burn_baudrate.1500000=1.5 Mbps
k1.menu.burn_baudrate.2000000=2 Mbps
k1.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
k1.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
k1.menu.burn_baudrate.2000000.build.burn_baudrate=2000000

k1.menu.enable_console.disable=Disable
k1.menu.enable_console.disable.build.enable_console=0
k1.menu.enable_console.enable=Enable
k1.menu.enable_console.enable.build.enable_console=1

k1.menu.stack_size.256K=256K
k1.menu.stack_size.128K=128K
k1.menu.stack_size.64K=64K
k1.menu.stack_size.256K.build.main_stack_size=262144
k1.menu.stack_size.128K.build.main_stack_size=131072
k1.menu.stack_size.64K.build.main_stack_size=65536

k1.menu.enable_only_kmodel_v3.disable=Disable
k1.menu.enable_only_kmodel_v3.disable.build.only_kmodel_v3=0
k1.menu.enable_only_kmodel_v3.enable=Enable
k1.menu.enable_only_kmodel_v3.enable.build.only_kmodel_v3=1
###############################################################

01studio_k210.name=01Studio K210

01studio_k210.upload.tool=kflash_py
01studio_k210.upload.tool.default=kflash_py

01studio_k210.upload.maximum_size=6291456
01studio_k210.upload.maximum_data_size=6291456
01studio_k210.upload.flags=
01studio_k210.upload.extra_flags=

01studio_k210.serial.disableDTR=true
01studio_k210.serial.disableRTS=true

01studio_k210.build.core=k210
01studio_k210.build.variant=01studio_k210
01studio_k210.build.board=01studio_k210
01studio_k210.build.burn_board=dan

01studio_k210.menu.clk_freq.400=400MHz
01studio_k210.menu.clk_freq.500=500MHz
01studio_k210.menu.clk_freq.600=600MHz
01studio_k210.menu.clk_freq.400.build.f_cpu=400000000UL
01studio_k210.menu.clk_freq.500.build.f_cpu=500000000UL
01studio_k210.menu.clk_freq.600.build.f_cpu=600000000UL

01studio_k210.menu.burn_baudrate.1000000=1 Mbps
01studio_k210.menu.burn_baudrate.1500000=1.5 Mbps
01studio_k210.menu.burn_baudrate.2000000=2 Mbps
01studio_k210.menu.burn_baudrate.1000000.build.burn_baudrate=1000000
01studio_k210.menu.burn_baudrate.1500000.build.burn_baudrate=1500000
01studio_k210.menu.burn_baudrate.2000000.build.burn_baudrate=2000000

01studio_k210.menu.enable_console.disable=Disable
01studio_k210.menu.enable_console.disable.build.enable_console=0
01studio_k210.menu.enable_console.enable=Enable
01studio_k210.menu.enable_console.enable.build.enable_console=1

01studio_k210.menu.stack_size.256K=256K
01studio_k210.menu.stack_size.128K=128K
01studio_k210.menu.stack_size.64K=64K
01studio_k210.menu.stack_size.256K.build.main_stack_size=262144
01studio_k210.menu.stack_size.128K.build.main_stack_size=131072
01studio_k210.menu.stack_size.64K.build.main_stack_size=65536

01studio_k210.menu.enable_only_kmodel_v3.disable=Disable
01studio_k210.menu.enable_only_kmodel_v3.disable.build.only_kmodel_v3=0
01studio_k210.menu.enable_only_kmodel_v3.enable=Enable
01studio_k210.menu.enable_only_kmodel_v3.enable.build.only_kmodel_v3=1
61 changes: 61 additions & 0 deletions cores/k210/Arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
Arduino API main include
Copyright (c) 2016 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef ARDUINO_API_H
#define ARDUINO_API_H

/* Standard C library includes */
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>

#include "rtthread.h"
#include "k210-hal.h"

// version 1.3.0
#define ARDUINO_API_VERSION 10300

#include "Binary.h"

#ifdef __cplusplus
// #include "Interrupts.h"
#include "IPAddress.h"
#include "Print.h"
#include "Printable.h"
// #include "PluggableUSB.h"
#include "Server.h"
#include "WString.h"
#include "Stream.h"
#include "Udp.h"
// #include "USBAPI.h"
#include "WCharacter.h"

#include "HardwareSerial.h"
#endif

// Misc Arduino core functions
#include "Common.h"

#ifdef __cplusplus
// Compatibility layer for older code
#include "Compat.h"
#endif

#include "pins_arduino.h"

#endif
Loading

0 comments on commit 464fb4a

Please sign in to comment.