[realtek-ambz2] Make compiling base core possible

This commit is contained in:
Kuba Szczodrzyński
2023-05-19 10:42:59 +02:00
parent 27a7faaab7
commit 07e9aa1ded
14 changed files with 321 additions and 3 deletions

View File

@@ -0,0 +1,12 @@
{
"flash": {
"ota1": "0x010000+0xE0000",
"ota2": "0x0F0000+0xE0000",
"kvs": "0x1D0000+0x8000",
"userdata": "0x1D8000+0x28000"
},
"upload": {
"flash_size": 2097152,
"maximum_size": 917504
}
}

View File

@@ -0,0 +1,96 @@
{
"image": {
"keys": {
"decryption": "a0d6dae7e062ca94cbb294bf896b9f68cf8438774256ac7403ca4fd9a1c9564f",
"keyblock": {
"part_table": "882aa16c8c44a7760aa8c9ab22e3568c6fa16c2afa4f0cea29a10abcdf60e44f",
"boot": "882aa16c8c44a7760aa8c9ab22e3568c6fa16c2afa4f0cea29a10abcdf60e44f"
},
"hash_keys": {
"part_table": "47e5661335a4c5e0a94d69f3c737d54f2383791332939753ef24279608f6d72b",
"boot": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"ota1": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e5f",
"ota2": "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e5f"
},
"user_keys": {
"boot": "aa0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
"ota1": "bb0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
"ota2": "bb0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
},
"xip_sce_key": "a0d6dae7e062ca94cbb294bf896b9f68",
"xip_sce_iv": "94879487948794879487948794879487"
},
"ptable": {
"boot": "BOOT",
"ota1": "FW1",
"ota2": "FW2"
},
"boot": {
"name": "boot.sram",
"type": "SRAM",
"entry": "__ram_start_table_start__",
"elf": [
".ram.func.table",
".data",
".ram.code_text",
".ram.code_rodata"
],
"is_boot": true
},
"fw": [
{
"type": "FWHS_S",
"sections": [
{
"name": "fwhs.sram",
"type": "SRAM",
"entry": "__ram_start_table_start__",
"elf": [
".ram.img.signature",
".ram.func.table",
".data",
".ram.code_text",
".ram.code_rodata"
]
},
{
"name": "fwhs.psram",
"type": "PSRAM",
"entry": "__psram_start__",
"elf": [
".psram.data",
".psram.code_text",
".psram.code_rodata"
]
}
]
},
{
"type": "XIP",
"sections": [
{
"name": "fwhs.xip_c",
"entry": "XIP_RamImgSignature_s",
"type": "XIP",
"elf": [
".xip.code_c"
]
}
]
},
{
"type": "XIP",
"sections": [
{
"name": "fwhs.xip_p",
"entry": "__xip_code_rodata_start__",
"type": "XIP",
"elf": [
".xip.code_p"
]
}
]
}
]
}
}

View File

@@ -16,7 +16,11 @@
"protocols": []
},
"upload": {
"maximum_ram_size": 262144
"maximum_ram_size": 262144,
"protocol": "uart",
"protocols": [
"uart"
]
},
"doc": {
"params": {

26
boards/bw15.json Normal file
View File

@@ -0,0 +1,26 @@
{
"_base": [
"realtek-ambz2",
"realtek-ambz2-8720",
"realtek-ambz2-image",
"realtek-ambz2-2mb-992k",
"ic/rtl8720cf",
"pcb/bw15"
],
"build": {
"mcu": "rtl8720cf",
"variant": "bw15"
},
"name": "BW15",
"url": "https://docs.ai-thinker.com/_media/rtl8710/docs/bw15_datasheet_en.pdf",
"vendor": "Ai-Thinker Co., Ltd.",
"pcb": {
"symbol": "BW15"
},
"doc": {
"fccid": "2AXVG-BW15",
"links": {
"Vendor datasheet": "https://docs.ai-thinker.com/_media/rtl8710/docs/bw15_datasheet_en.pdf"
}
}
}

View File

@@ -0,0 +1,102 @@
{
"_base": [
"generic",
"realtek-ambz2",
"realtek-ambz2-8720",
"realtek-ambz2-image",
"realtek-ambz2-2mb-992k",
"ic/rtl8720cf"
],
"build": {
"mcu": "rtl8720cf",
"variant": "generic-rtl8720cf-2mb-992k"
},
"name": "Generic - RTL8720CF (2M/992k)",
"symbol": "RTL8720CF (2M/992k)",
"url": "https://docs.libretiny.eu/boards/generic-rtl8720cf-2mb-992k/",
"vendor": "Generic",
"pcb": {
"pinout": {
"1": {
"IC": 15,
"ARD": "D0"
},
"2": {
"IC": 16,
"ARD": "D1"
},
"3": {
"IC": 18,
"ARD": "D2"
},
"4": {
"IC": 19,
"ARD": "D3"
},
"5": {
"IC": 20,
"ARD": "D4"
},
"6": {
"IC": 21,
"ARD": "D5"
},
"7": {
"IC": 22,
"ARD": "D6"
},
"8": {
"IC": 23,
"ARD": "D7"
},
"9": {
"IC": 24,
"ARD": "D8"
},
"10": {
"IC": 25,
"ARD": "D9"
},
"11": {
"IC": 26,
"ARD": "D10"
},
"12": {
"IC": 33,
"ARD": "D11"
},
"13": {
"IC": 34,
"ARD": "D12"
},
"14": {
"IC": 36,
"ARD": "D13"
},
"15": {
"IC": 37,
"ARD": "D14"
},
"16": {
"IC": 38,
"ARD": "D15"
},
"17": {
"IC": 39,
"ARD": "D16"
},
"18": {
"IC": 40,
"ARD": "D17"
},
"19": {
"IC": 1,
"ARD": "D18"
},
"20": {
"IC": 3,
"ARD": "D19"
}
}
}
}

View File

@@ -1,6 +1,7 @@
# Copyright (c) Kuba Szczodrzyński 2022-07-20.
from os.path import join
from os.path import isfile, join
from shutil import copyfile
from platformio.platform.base import PlatformBase
from platformio.platform.board import PlatformBoardConfig
@@ -436,10 +437,25 @@ env.Replace(
SIZEPRINTCMD="$SIZETOOL -B -d $SOURCES",
)
# Bootloader - copy for linking
# fmt: off
bootloader_src = env.subst("${SDK_DIR}/component/soc/realtek/8710c/misc/bsp/image/bootloader.axf")
bootloader_dst = env.subst("${BUILD_DIR}/bootloader.axf")
# fmt: on
if not isfile(bootloader_dst):
copyfile(bootloader_src, bootloader_dst)
# Build all libraries
queue.BuildLibraries()
# Main firmware outputs and actions
image_firmware_is = "${BUILD_DIR}/image_firmware_is.${FLASH_OTA1_OFFSET}.bin"
env.Replace(
# TODO
# linker command (dual .bin outputs)
LINK="${LTCHIPTOOL} link2bin ${BOARD_JSON} '' ''",
# UF2OTA input list
UF2OTA=[
# same OTA images for flasher and device
f"{image_firmware_is},{image_firmware_is}=device:ota1,ota2;flasher:ota1,ota2",
],
)

View File

@@ -40,6 +40,8 @@ typedef enum {
RTL8711BU = CPU_MODEL(F_RTL8710B, 0xFC), // CHIPID_8711BG / QFN68
MX1290 = RTL8710BN,
MX1290V2 = RTL8710BX,
// Realtek AmebaZ2
RTL8720CF = CPU_MODEL(F_RTL8720C, 0x00), // TODO
// Beken 72XX
BK7231T = CPU_MODEL(F_BK7231U, 0x1A), // *SCTRL_CHIP_ID = 0x7231a
BK7231N = CPU_MODEL(F_BK7231N, 0x1C), // *SCTRL_CHIP_ID = 0x7231c

View File

@@ -20,6 +20,7 @@ extern "C" {
#include <rtl8710b.h>
#endif
#if LT_RTL8720C
#include <hal.h>
#include <rtl8710c.h>
#endif

View File

@@ -0,0 +1,3 @@
/* Copyright (c) Kuba Szczodrzyński 2023-04-12. */
void shell_cmd_init() {}

View File

@@ -0,0 +1,38 @@
/* Copyright (c) Kuba Szczodrzyński 2023-04-12. */
#include <libretiny.h>
#include <sdk_private.h>
#include <printf/printf.h>
static UART0_Type *uart_dev[4] = {
UART0,
UART1,
UART2,
UART3,
};
uint8_t lt_uart_port = 2;
void putchar_(char c) {
putchar_p(c, lt_uart_port);
}
void putchar_p(char c, unsigned long port) {
// while (UART_Writable(uart_dev[port]) == 0) {}
uart_dev[port]->thr = c;
}
WRAP_PRINTF(rtl_printf);
WRAP_SPRINTF(rtl_sprintf);
WRAP_SNPRINTF(rtl_snprintf);
WRAP_VSNPRINTF(rtl_vsnprintf);
WRAP_VSNPRINTF(rtl_vsnprintf_r);
WRAP_VPRINTF(rtl_vprintf);
WRAP_PRINTF(DiagPrintf);
WRAP_SPRINTF(DiagSPrintf);
WRAP_SNPRINTF(DiagSnPrintf);
WRAP_PRINTF(prvDiagPrintf);
WRAP_SPRINTF(prvDiagSPrintf);
WRAP_VSPRINTF(VSprintf);
WRAP_PRINTF(LOG_PRINTF);

View File

@@ -0,0 +1,18 @@
/* Copyright (c) Kuba Szczodrzyński 2022-06-20. */
#pragma once
#include <printf_config.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
WRAP_DISABLE_DEF(rtl_printf);
WRAP_DISABLE_DEF(DiagPrintf);
WRAP_DISABLE_DEF(prvDiagPrintf);
WRAP_DISABLE_DEF(LOG_PRINTF);
#ifdef __cplusplus
} // extern "C"
#endif