Unverified Commit f8a2f38f authored by Ha Thach's avatar Ha Thach Committed by GitHub

Port Adafruit_TinyUSB_Arduino lib (#127)

* initial tinyusb lib port

* add Adafruit_TinyUSB_Arduino as submodules

* add yield() to main loop

* sync with tinyusb lib latest

* add USB manufacturer and product

* fix typo in tinyusb lib

* sync with master

updating implementation

* Rationalize link stage command line

Make the build process less insane.

* clean up delay

* clean up platform and board

* update makeboards.py for generating usbstack menu

* update tinyusb lib to 1.0.0
parent 39d1a286
......@@ -22,3 +22,6 @@
[submodule "libraries/Mouse"]
path = libraries/Mouse
url = https://github.com/earlephilhower/Mouse
[submodule "libraries/Adafruit_TinyUSB_Arduino"]
path = libraries/Adafruit_TinyUSB_Arduino
url = https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git
......@@ -4,6 +4,11 @@ menu.freq=CPU Speed
menu.dbgport=Debug Port
menu.dbglvl=Debug Level
menu.boot2=Boot Stage 2
menu.usbstack=USB Stack
# -----------------------------------
# Raspberry Pi Pico
# -----------------------------------
rpipico.name=Raspberry Pi Pico
rpipico.vid.0=0x2e8a
rpipico.pid.0=0x000a
......@@ -24,6 +29,10 @@ rpipico.build.core=rp2040
rpipico.build.mcu=rp2040
rpipico.build.ldscript=memmap_default.ld
rpipico.build.boot2=boot2_w25q080_2_padded_checksum
rpipico.build.vid=0x2e8a
rpipico.build.pid=0x000a
rpipico.build.usb_manufacturer="Raspberry Pi"
rpipico.build.usb_product="Pico"
rpipico.menu.flash.2097152_0=2MB (no FS)
rpipico.menu.flash.2097152_0.upload.maximum_size=2093056
rpipico.menu.flash.2097152_0.build.flash_length=2093056
......@@ -102,6 +111,14 @@ rpipico.menu.dbglvl.All=All
rpipico.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
rpipico.menu.dbglvl.NDEBUG=NDEBUG
rpipico.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
rpipico.menu.usbstack.picosdk=Pico SDK
rpipico.menu.usbstack.picosdk.build.usbstack_flags=
rpipico.menu.usbstack.tinyusb=Adafruit TinyUSB
rpipico.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{build.core.path}/TinyUSB" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
# -----------------------------------
# Raspberry Pi Pico (Picoprobe)
# -----------------------------------
rpipicopicoprobe.name=Raspberry Pi Pico (Picoprobe)
rpipicopicoprobe.vid.0=0x2e8a
rpipicopicoprobe.pid.0=0x0004
......@@ -122,6 +139,10 @@ rpipicopicoprobe.build.core=rp2040
rpipicopicoprobe.build.mcu=rp2040
rpipicopicoprobe.build.ldscript=memmap_default.ld
rpipicopicoprobe.build.boot2=boot2_w25q080_2_padded_checksum
rpipicopicoprobe.build.vid=0x2e8a
rpipicopicoprobe.build.pid=0x000a
rpipicopicoprobe.build.usb_manufacturer="Raspberry Pi"
rpipicopicoprobe.build.usb_product="Pico (Picoprobe)"
rpipicopicoprobe.menu.flash.2097152_0=2MB (no FS)
rpipicopicoprobe.menu.flash.2097152_0.upload.maximum_size=2093056
rpipicopicoprobe.menu.flash.2097152_0.build.flash_length=2093056
......@@ -200,10 +221,18 @@ rpipicopicoprobe.menu.dbglvl.All=All
rpipicopicoprobe.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
rpipicopicoprobe.menu.dbglvl.NDEBUG=NDEBUG
rpipicopicoprobe.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
rpipicopicoprobe.menu.usbstack.picosdk=Pico SDK
rpipicopicoprobe.menu.usbstack.picosdk.build.usbstack_flags=
rpipicopicoprobe.menu.usbstack.tinyusb=Adafruit TinyUSB
rpipicopicoprobe.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{build.core.path}/TinyUSB" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
# -----------------------------------
# Adafruit Feather RP2040
# -----------------------------------
adafruitfeather.name=Adafruit Feather RP2040
adafruitfeather.vid.0=0x2e8a
adafruitfeather.pid.0=0x000b
adafruitfeather.build.usbpid=-DSERIALUSB_PID=0x000b
adafruitfeather.vid.0=0x239a
adafruitfeather.pid.0=0x80f1
adafruitfeather.build.usbpid=-DSERIALUSB_PID=0x80f1
adafruitfeather.build.board=ADAFRUIT_FEATHER_RP2040
adafruitfeather.build.mcu=cortex-m0plus
adafruitfeather.build.variant=adafruitfeather
......@@ -220,6 +249,10 @@ adafruitfeather.build.core=rp2040
adafruitfeather.build.mcu=rp2040
adafruitfeather.build.ldscript=memmap_default.ld
adafruitfeather.build.boot2=boot2_w25x10cl_4_padded_checksum
adafruitfeather.build.vid=0x239a
adafruitfeather.build.pid=0x80f1
adafruitfeather.build.usb_manufacturer="Adafruit"
adafruitfeather.build.usb_product="Feather RP2040"
adafruitfeather.menu.flash.8388608_0=8MB (no FS)
adafruitfeather.menu.flash.8388608_0.upload.maximum_size=8384512
adafruitfeather.menu.flash.8388608_0.build.flash_length=8384512
......@@ -334,10 +367,18 @@ adafruitfeather.menu.dbglvl.All=All
adafruitfeather.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
adafruitfeather.menu.dbglvl.NDEBUG=NDEBUG
adafruitfeather.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
adafruitfeather.menu.usbstack.picosdk=Pico SDK
adafruitfeather.menu.usbstack.picosdk.build.usbstack_flags=
adafruitfeather.menu.usbstack.tinyusb=Adafruit TinyUSB
adafruitfeather.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{build.core.path}/TinyUSB" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
# -----------------------------------
# Adafruit Feather RP2040 (Picoprobe)
# -----------------------------------
adafruitfeatherpicoprobe.name=Adafruit Feather RP2040 (Picoprobe)
adafruitfeatherpicoprobe.vid.0=0x2e8a
adafruitfeatherpicoprobe.vid.0=0x239a
adafruitfeatherpicoprobe.pid.0=0x0004
adafruitfeatherpicoprobe.build.usbpid=-DSERIALUSB_PID=0x000b
adafruitfeatherpicoprobe.build.usbpid=-DSERIALUSB_PID=0x80f1
adafruitfeatherpicoprobe.build.board=ADAFRUIT_FEATHER_RP2040
adafruitfeatherpicoprobe.build.mcu=cortex-m0plus
adafruitfeatherpicoprobe.build.variant=adafruitfeather
......@@ -354,6 +395,10 @@ adafruitfeatherpicoprobe.build.core=rp2040
adafruitfeatherpicoprobe.build.mcu=rp2040
adafruitfeatherpicoprobe.build.ldscript=memmap_default.ld
adafruitfeatherpicoprobe.build.boot2=boot2_w25x10cl_4_padded_checksum
adafruitfeatherpicoprobe.build.vid=0x239a
adafruitfeatherpicoprobe.build.pid=0x80f1
adafruitfeatherpicoprobe.build.usb_manufacturer="Adafruit"
adafruitfeatherpicoprobe.build.usb_product="Feather RP2040 (Picoprobe)"
adafruitfeatherpicoprobe.menu.flash.8388608_0=8MB (no FS)
adafruitfeatherpicoprobe.menu.flash.8388608_0.upload.maximum_size=8384512
adafruitfeatherpicoprobe.menu.flash.8388608_0.build.flash_length=8384512
......@@ -468,6 +513,14 @@ adafruitfeatherpicoprobe.menu.dbglvl.All=All
adafruitfeatherpicoprobe.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
adafruitfeatherpicoprobe.menu.dbglvl.NDEBUG=NDEBUG
adafruitfeatherpicoprobe.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
adafruitfeatherpicoprobe.menu.usbstack.picosdk=Pico SDK
adafruitfeatherpicoprobe.menu.usbstack.picosdk.build.usbstack_flags=
adafruitfeatherpicoprobe.menu.usbstack.tinyusb=Adafruit TinyUSB
adafruitfeatherpicoprobe.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{build.core.path}/TinyUSB" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
# -----------------------------------
# Generic RP2040
# -----------------------------------
generic.name=Generic RP2040
generic.vid.0=0x2e8a
generic.pid.0=0xf00a
......@@ -488,6 +541,10 @@ generic.build.core=rp2040
generic.build.mcu=rp2040
generic.build.ldscript=memmap_default.ld
generic.build.boot2=boot2_generic_03h_4_padded_checksum
generic.build.vid=0x2e8a
generic.build.pid=0xf00a
generic.build.usb_manufacturer="Generic"
generic.build.usb_product="RP2040"
generic.menu.flash.2097152_0=2MB (no FS)
generic.menu.flash.2097152_0.upload.maximum_size=2093056
generic.menu.flash.2097152_0.build.flash_length=2093056
......@@ -578,6 +635,10 @@ generic.menu.dbglvl.All=All
generic.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
generic.menu.dbglvl.NDEBUG=NDEBUG
generic.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
generic.menu.usbstack.picosdk=Pico SDK
generic.menu.usbstack.picosdk.build.usbstack_flags=
generic.menu.usbstack.tinyusb=Adafruit TinyUSB
generic.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{build.core.path}/TinyUSB" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
generic.menu.boot2.boot2_generic_03h_2_padded_checksum=Generic SPI /2
generic.menu.boot2.boot2_generic_03h_2_padded_checksum.build.boot2=boot2_generic_03h_2_padded_checksum
generic.menu.boot2.boot2_generic_03h_4_padded_checksum=Generic SPI /4
......@@ -594,6 +655,10 @@ generic.menu.boot2.boot2_w25x10cl_2_padded_checksum=W25X10CL QSPI /2
generic.menu.boot2.boot2_w25x10cl_2_padded_checksum.build.boot2=boot2_w25x10cl_2_padded_checksum
generic.menu.boot2.boot2_w25x10cl_4_padded_checksum=W25X10CL QSPI /4
generic.menu.boot2.boot2_w25x10cl_4_padded_checksum.build.boot2=boot2_w25x10cl_4_padded_checksum
# -----------------------------------
# Generic RP2040 (Picoprobe)
# -----------------------------------
genericpicoprobe.name=Generic RP2040 (Picoprobe)
genericpicoprobe.vid.0=0x2e8a
genericpicoprobe.pid.0=0x0004
......@@ -614,6 +679,10 @@ genericpicoprobe.build.core=rp2040
genericpicoprobe.build.mcu=rp2040
genericpicoprobe.build.ldscript=memmap_default.ld
genericpicoprobe.build.boot2=boot2_generic_03h_4_padded_checksum
genericpicoprobe.build.vid=0x2e8a
genericpicoprobe.build.pid=0xf00a
genericpicoprobe.build.usb_manufacturer="Generic"
genericpicoprobe.build.usb_product="RP2040 (Picoprobe)"
genericpicoprobe.menu.flash.2097152_0=2MB (no FS)
genericpicoprobe.menu.flash.2097152_0.upload.maximum_size=2093056
genericpicoprobe.menu.flash.2097152_0.build.flash_length=2093056
......@@ -704,6 +773,10 @@ genericpicoprobe.menu.dbglvl.All=All
genericpicoprobe.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
genericpicoprobe.menu.dbglvl.NDEBUG=NDEBUG
genericpicoprobe.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
genericpicoprobe.menu.usbstack.picosdk=Pico SDK
genericpicoprobe.menu.usbstack.picosdk.build.usbstack_flags=
genericpicoprobe.menu.usbstack.tinyusb=Adafruit TinyUSB
genericpicoprobe.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{build.core.path}/TinyUSB" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
genericpicoprobe.menu.boot2.boot2_generic_03h_2_padded_checksum=Generic SPI /2
genericpicoprobe.menu.boot2.boot2_generic_03h_2_padded_checksum.build.boot2=boot2_generic_03h_2_padded_checksum
genericpicoprobe.menu.boot2.boot2_generic_03h_4_padded_checksum=Generic SPI /4
......
......@@ -95,7 +95,14 @@ unsigned long millis();
#define HAVE_HWSERIAL2
#ifdef __cplusplus
#include "SerialUSB.h"
#ifdef USE_TINYUSB
// Needed for declaring Serial
#include "Adafruit_USBD_CDC.h"
#else
#include "SerialUSB.h"
#endif
#include "SerialUART.h"
#include "RP2040.h"
#include "Bootsel.h"
......
......@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef USE_TINYUSB
#include <Arduino.h>
#include "CoreMutex.h"
#include "RP2040USB.h"
......@@ -317,3 +319,5 @@ void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uin
(void) bufsize;
}
#endif
......@@ -20,6 +20,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef USE_TINYUSB
#include <Arduino.h>
#include "CoreMutex.h"
......@@ -189,3 +191,5 @@ void arduino::serialEventRun(void)
serialEvent();
}
}
#endif
#include "api/String.h"
#include "api/Stream.h"
/*
* The MIT License (MIT)
*
* Copyright (c) 2018, hathach for Adafruit
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef _TUSB_CONFIG_H_
#define _TUSB_CONFIG_H_
#ifdef __cplusplus
extern "C" {
#endif
//--------------------------------------------------------------------
// COMMON CONFIGURATION
//--------------------------------------------------------------------
#ifdef USE_TINYUSB
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_NONE
#endif
//#ifndef CFG_TUSB_MCU
// #define CFG_TUSB_MCU OPT_MCU_RP2040
//#endif
#define CFG_TUSB_OS OPT_OS_PICO
#define CFG_TUSB_DEBUG 0
//#if CFG_TUSB_DEBUG
// #define tu_printf serial1_printf
// extern int serial1_printf(const char *__restrict __format, ...);
//#endif
#define CFG_TUSB_MEM_SECTION
#define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)
//--------------------------------------------------------------------
// DEVICE CONFIGURATION
//--------------------------------------------------------------------
#define CFG_TUD_ENDOINT0_SIZE 64
//------------- CLASS -------------//
#define CFG_TUD_CDC 1
#define CFG_TUD_MSC 1
#define CFG_TUD_HID 1
#define CFG_TUD_MIDI 1
#define CFG_TUD_VENDOR 1
// CDC FIFO size of TX and RX
#define CFG_TUD_CDC_RX_BUFSIZE 256
#define CFG_TUD_CDC_TX_BUFSIZE 256
// MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_BUFSIZE 512
// HID buffer size Should be sufficient to hold ID (if any) + Data
#define CFG_TUD_HID_BUFSIZE 64
// MIDI FIFO size of TX and RX
#define CFG_TUD_MIDI_RX_BUFSIZE 128
#define CFG_TUD_MIDI_TX_BUFSIZE 128
// Vendor FIFO size of TX and RX
#define CFG_TUD_VENDOR_RX_BUFSIZE 64
#define CFG_TUD_VENDOR_TX_BUFSIZE 64
#ifdef __cplusplus
}
#endif
#endif /* _TUSB_CONFIG_H_ */
......@@ -21,7 +21,14 @@
#include <pico.h>
#include <pico/time.h>
extern "C" void delay( unsigned long ms ) {
#ifdef USE_TINYUSB
#include "Adafruit_TinyUSB_API.h"
#endif
extern "C"
{
void delay( unsigned long ms ) {
if (!ms) {
return;
}
......@@ -29,22 +36,27 @@ extern "C" void delay( unsigned long ms ) {
sleep_ms(ms);
}
extern "C" void delayMicroseconds( unsigned int usec ) {
void delayMicroseconds( unsigned int usec ) {
if (!usec) {
return;
}
sleep_us(usec);
}
extern "C" void yield() {
// NOOP
void yield() {
#ifdef USE_TINYUSB
TinyUSB_Device_Task();
TinyUSB_Device_FlushCDC();
#endif
}
extern "C" uint32_t millis() {
uint32_t millis() {
return to_ms_since_boot(get_absolute_time());
}
extern "C" uint32_t micros() {
uint32_t micros() {
return to_us_since_boot(get_absolute_time());
}
} // extern C
......@@ -59,11 +59,17 @@ extern "C" int main() {
mutex_init(&_pioMutex);
initVariant();
#ifdef USE_TINYUSB
TinyUSB_Device_Init(0);
#else
__USBStart();
#ifndef DISABLE_USB_SERIAL
#ifndef DISABLE_USB_SERIAL
// Enable serial port for reset/upload always
Serial.begin();
#endif
#endif
#if defined DEBUG_RP2040_PORT
......@@ -81,6 +87,11 @@ extern "C" int main() {
setup();
while (true) {
loop();
#ifdef USE_TINYUSB
yield();
#endif
if (arduino::serialEventRun) {
arduino::serialEventRun();
}
......
Subproject commit 1b8b9c9b071065235341d0e503f2d6d05de19524
......@@ -38,7 +38,7 @@ compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra
compiler.defines={build.led}
compiler.defines={build.led} {build.usbstack_flags} -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'
compiler.includes="-iprefix{runtime.platform.path}/" "@{runtime.platform.path}/lib/platform_inc.txt"
compiler.flags=-Os -march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections -fno-exceptions
compiler.wrap="@{runtime.platform.path}/lib/platform_wrap.txt"
......@@ -81,6 +81,7 @@ build.flash_length=
build.eeprom_start=
build.fs_start=
build.fs_end=
build.usbstack_flags=
build.boot2=boot2_generic_03h_4_padded_checksum
......
......@@ -44,9 +44,20 @@ def BuildBoot(name):
print("%s.menu.boot2.%s=%s" % (name, l[1], l[0]))
print("%s.menu.boot2.%s.build.boot2=%s" % (name, l[1], l[1]))
def BuildHeader(name, prettyname, pidtouse, pid, boarddefine, variant, uploadtool, flashsize, boot2):
def BuildUSBStack(name):
print("%s.menu.usbstack.picosdk=Pico SDK" % (name))
print("%s.menu.usbstack.picosdk.build.usbstack_flags=" % (name))
print("%s.menu.usbstack.tinyusb=Adafruit TinyUSB" % (name))
print('%s.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{build.core.path}/TinyUSB" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"' % (name))
def BuildHeader(name, vendor_name, product_name, pidtouse, vid, pid, boarddefine, variant, uploadtool, flashsize, boot2):
prettyname = vendor_name + " " + product_name
print()
print("# -----------------------------------")
print("# %s" % (prettyname))
print("# -----------------------------------")
print("%s.name=%s" % (name, prettyname))
print("%s.vid.0=0x2e8a" % (name))
print("%s.vid.0=%s" % (name, vid))
print("%s.pid.0=%s" % (name, pidtouse))
print("%s.build.usbpid=-DSERIALUSB_PID=%s" % (name, pid))
print("%s.build.board=%s" % (name, boarddefine))
......@@ -65,6 +76,10 @@ def BuildHeader(name, prettyname, pidtouse, pid, boarddefine, variant, uploadtoo
print("%s.build.mcu=rp2040" % (name))
print("%s.build.ldscript=memmap_default.ld" % (name))
print("%s.build.boot2=%s" % (name, boot2))
print("%s.build.vid=%s" % (name, vid))
print("%s.build.pid=%s" % (name, pid))
print('%s.build.usb_manufacturer="%s"' % (name, vendor_name))
print('%s.build.usb_product="%s"' % (name, product_name))
def BuildGlobalMenuList():
print("menu.BoardModel=Model")
......@@ -73,12 +88,13 @@ def BuildGlobalMenuList():
print("menu.dbgport=Debug Port")
print("menu.dbglvl=Debug Level")
print("menu.boot2=Boot Stage 2")
print("menu.usbstack=USB Stack")
def MakeBoard(name, prettyname, pid, boarddefine, flashsizemb, boot2):
def MakeBoard(name, vendor_name, product_name, vid, pid, boarddefine, flashsizemb, boot2):
for a, b, c in [ ["", "", "uf2conv"], ["picoprobe", " (Picoprobe)", "picoprobe"]]:
n = name + a
p = prettyname + b
p = product_name + b
fssizelist = [ 0, 64 * 1024, 128 * 1024, 256 * 1024, 512 * 1024 ]
for i in range(1, flashsizemb):
fssizelist.append(i * 1024 * 1024)
......@@ -86,7 +102,7 @@ def MakeBoard(name, prettyname, pid, boarddefine, flashsizemb, boot2):
pidtouse = '0x0004'
else:
pidtouse = pid
BuildHeader(n, p, pidtouse, pid, boarddefine, name, c, flashsizemb * 1024 * 1024, boot2)
BuildHeader(n, vendor_name, p, pidtouse, vid, pid, boarddefine, name, c, flashsizemb * 1024 * 1024, boot2)
if name == "generic":
BuildFlashMenu(n, 2*1024*1024, [0, 1*1024*1024])
BuildFlashMenu(n, 4*1024*1024, [0, 2*1024*1024])
......@@ -97,12 +113,13 @@ def MakeBoard(name, prettyname, pid, boarddefine, flashsizemb, boot2):
BuildFreq(n)
BuildDebugPort(n)
BuildDebugLevel(n)
BuildUSBStack(n)
if name == "generic":
BuildBoot(n)
BuildGlobalMenuList()
MakeBoard("rpipico", "Raspberry Pi Pico", "0x000a", "RASPBERRY_PI_PICO", 2, "boot2_w25q080_2_padded_checksum")
MakeBoard("adafruitfeather", "Adafruit Feather RP2040", "0x000b", "ADAFRUIT_FEATHER_RP2040", 8, "boot2_w25x10cl_4_padded_checksum")
MakeBoard("generic", "Generic RP2040", "0xf00a", "GENERIC_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
MakeBoard("rpipico", "Raspberry Pi", "Pico", "0x2e8a", "0x000a", "RASPBERRY_PI_PICO", 2, "boot2_w25q080_2_padded_checksum")
MakeBoard("adafruitfeather", "Adafruit", "Feather RP2040", "0x239a", "0x80f1", "ADAFRUIT_FEATHER_RP2040", 8, "boot2_w25x10cl_4_padded_checksum")
MakeBoard("generic", "Generic", "RP2040", "0x2e8a", "0xf00a", "GENERIC_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment