Compare commits

..
13 Commits
Author SHA1 Message Date
Earle F. Philhower, III e196db9645 Update README.md 2021-07-29 09:02:45 -07:00
Pontus Oldberg 733aca5ac3 Adds support for Challenger RP2040 WiFi boards (#268) 2021-07-29 08:59:27 -07:00
Earle F. Philhower, III 177a2d03a1 Update pull-request.yml 2021-07-29 07:56:10 -07:00
Earle F. Philhower, III fec3ea882d Minor paranoid nullptr checks in USB interface (#267)
Identify some spots that GCC's -fanalyzer noted might need nullptr
checks, and add them.
2021-07-28 18:11:25 -07:00
Earle F. Philhower, III 580970cd72 Use Stream::setTimeout to specify I2C TO (#263)
Use the existing Arduino Stream method of setTimeout to set the Wire
I2C timeout delay.

Fixes #260
2021-07-23 15:20:34 -07:00
Earle F. Philhower, III c13bb1ec2b Make multiple SDFS/LittleFS.begin calls noops (#262)
When LittleFS.begin() or SDFS.begin() is called after the filesystem is
already mounted, don't unmount/remount.  When an unmount happens, all old
Files become invalid (but the core doesn't know this), so you would end
up with random crashes in FS code.

Now, check for _mounted, and if so just return immediately from begin().
2021-07-23 14:16:57 -07:00
Ubi de Feo c777dd1657 Fix JSON URL (#261)
you had "esrle" instead of "earle" in the GH URL :)
2021-07-23 08:17:32 -07:00
Earle F. Philhower, III cb9931f3e8 Set available() to 0 when Wire.requestFrom fails (#259)
Wire::requestFrom() returns the number of bytes read from the slave.  In
the case of error, the slave can end up returning a very large integer
for PICO_GENERIC_ERROR which would then be used as the # of bytes read
causing crashes and errors.

Running TalkingToMyself without connecting the I2C ports would show
this behavior.

Now, when PICO_GENERIC_ERROR is returned, set the read-back buffer len
to 0 explicitly.
2021-07-21 18:59:24 -07:00
Giampiero Baggiani 6b6254e84a Added missing SPI::setCS(pin) in docs (#256) 2021-07-20 03:45:01 -07:00
Maximilian Gerhardt 61c6305aa8 Fix upload file path escaping on Windows (#254) 2021-07-19 08:46:55 -07:00
Earle F. Philhower, III b43056cd73 Avoid issues w/other installed Windows Pythons (#253)
When a Python MSI/etc. is installed under Windows, it sets a global
PYTHONHOME and other variables.  Our shipped Python can end up using
these variables and attempt to load the wrong PYC files and fail
to run.

Avoid by using -I isolated mode in Python calls

Fixes #252
2021-07-19 08:16:22 -07:00
Earle F. Philhower, III e4c144829c Remove exception handling code, save RAM and FLASH (#245)
Use a libstdc++ compiled with -fno-exceptions to avoid including the
code needed to unwind C++ exceptions.

Saves ~4K RAM and ~5K flash.
2021-07-17 10:55:47 -07:00
Earle F. Philhower, III 05356da2c5 Fix PWM frequency at low and high frequencies (#244)
The PWM HW can only divide 125MHZ sysclk by 1...256.  That's only down to
about 500khz.  If the max count of the PWM (analogWriteScale) is too low
then the actual PWM period will be much less than desired (and PWM frequency
of course much higher).

For example, at analogWriteFreq(100); analogWriteScale(256); the true
PWM period would be 125M / 256 (pwmdiv) / 256 (scale) = ~2khz.

Conversely, at high frequencies and large scales it is impossible to achieve
the requested frequency and a much lower one would be generated.  For
example: freq(60K), scale(32768). PWM period = 125M / 1 (pwmdiv) / 32768 =
~4kHz.

Avoid this by adjusting the analogWrite scale in the core to either increase
the PWM count for low frequencies, or decrease it for high frequencies.
This is done behind the scenes and code is not required to be changed.

The PWM frequency will still not be perfcetly exact due to the divider HW
and clocks involved, but it will be very close across the whole range.

Fixes #234
2021-07-15 08:34:53 -07:00
16 changed files with 604 additions and 43 deletions
+2
View File
@@ -37,6 +37,8 @@ jobs:
- name: Check boards.txt was not edited after makeboards.py
run: |
./tools/makeboards.py > boards.txt
# If anything changed, GIT should return an error and fail the test
git diff --exit-code
- name: Run astyle on all code/examples
run: |
sudo apt update
+1
View File
@@ -18,6 +18,7 @@ See https://arduino-pico.readthedocs.io/en/latest/ along with the examples for m
* Adafruit STEMMA Friend RP2040
* Adafruit Trinkey RP2040 QT
* Arduino Nano RP2040 Connect (preliminary)
* Invector Labs Challenger RP2040 WiFi
* SparkFun ProMicro RP2040
* Generic (configurable flash, I/O pins)
+439
View File
@@ -4551,3 +4551,442 @@ genericpicodebug.menu.boot2.boot2_w25x10cl_2_padded_checksum=W25X10CL QSPI /2
genericpicodebug.menu.boot2.boot2_w25x10cl_2_padded_checksum.build.boot2=boot2_w25x10cl_2_padded_checksum
genericpicodebug.menu.boot2.boot2_w25x10cl_4_padded_checksum=W25X10CL QSPI /4
genericpicodebug.menu.boot2.boot2_w25x10cl_4_padded_checksum.build.boot2=boot2_w25x10cl_4_padded_checksum
# -----------------------------------
# iLabs Challenger 2040 WiFi
# -----------------------------------
challenger_2040_wifi.name=iLabs Challenger 2040 WiFi
challenger_2040_wifi.vid.0=0x2e8a
challenger_2040_wifi.pid.0=0x1006
challenger_2040_wifi.build.usbpid=-DSERIALUSB_PID=0x1006
challenger_2040_wifi.build.board=CHALLENGER_2040_WIFI_RP2040
challenger_2040_wifi.build.mcu=cortex-m0plus
challenger_2040_wifi.build.variant=challenger_2040_wifi
challenger_2040_wifi.upload.tool=uf2conv
challenger_2040_wifi.upload.maximum_size=8388608
challenger_2040_wifi.upload.maximum_data_size=262144
challenger_2040_wifi.upload.wait_for_upload_port=true
challenger_2040_wifi.upload.erase_cmd=
challenger_2040_wifi.serial.disableDTR=false
challenger_2040_wifi.serial.disableRTS=false
challenger_2040_wifi.build.f_cpu=125000000
challenger_2040_wifi.build.led=
challenger_2040_wifi.build.core=rp2040
challenger_2040_wifi.build.mcu=rp2040
challenger_2040_wifi.build.ldscript=memmap_default.ld
challenger_2040_wifi.build.ram_length=256k
challenger_2040_wifi.build.boot2=boot2_w25q080_4_padded_checksum
challenger_2040_wifi.build.vid=0x2e8a
challenger_2040_wifi.build.pid=0x1006
challenger_2040_wifi.build.usb_manufacturer="iLabs"
challenger_2040_wifi.build.usb_product="Challenger 2040 WiFi"
challenger_2040_wifi.menu.flash.8388608_0=8MB (no FS)
challenger_2040_wifi.menu.flash.8388608_0.upload.maximum_size=8384512
challenger_2040_wifi.menu.flash.8388608_0.build.flash_length=8384512
challenger_2040_wifi.menu.flash.8388608_0.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_0.build.fs_start=276819968
challenger_2040_wifi.menu.flash.8388608_0.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_65536=8MB (Sketch: 8128KB, FS: 64KB)
challenger_2040_wifi.menu.flash.8388608_65536.upload.maximum_size=8318976
challenger_2040_wifi.menu.flash.8388608_65536.build.flash_length=8318976
challenger_2040_wifi.menu.flash.8388608_65536.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_65536.build.fs_start=276754432
challenger_2040_wifi.menu.flash.8388608_65536.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_131072=8MB (Sketch: 8064KB, FS: 128KB)
challenger_2040_wifi.menu.flash.8388608_131072.upload.maximum_size=8253440
challenger_2040_wifi.menu.flash.8388608_131072.build.flash_length=8253440
challenger_2040_wifi.menu.flash.8388608_131072.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_131072.build.fs_start=276688896
challenger_2040_wifi.menu.flash.8388608_131072.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_262144=8MB (Sketch: 7936KB, FS: 256KB)
challenger_2040_wifi.menu.flash.8388608_262144.upload.maximum_size=8122368
challenger_2040_wifi.menu.flash.8388608_262144.build.flash_length=8122368
challenger_2040_wifi.menu.flash.8388608_262144.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_262144.build.fs_start=276557824
challenger_2040_wifi.menu.flash.8388608_262144.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_524288=8MB (Sketch: 7680KB, FS: 512KB)
challenger_2040_wifi.menu.flash.8388608_524288.upload.maximum_size=7860224
challenger_2040_wifi.menu.flash.8388608_524288.build.flash_length=7860224
challenger_2040_wifi.menu.flash.8388608_524288.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_524288.build.fs_start=276295680
challenger_2040_wifi.menu.flash.8388608_524288.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_1048576=8MB (Sketch: 7MB, FS: 1MB)
challenger_2040_wifi.menu.flash.8388608_1048576.upload.maximum_size=7335936
challenger_2040_wifi.menu.flash.8388608_1048576.build.flash_length=7335936
challenger_2040_wifi.menu.flash.8388608_1048576.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_1048576.build.fs_start=275771392
challenger_2040_wifi.menu.flash.8388608_1048576.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_2097152=8MB (Sketch: 6MB, FS: 2MB)
challenger_2040_wifi.menu.flash.8388608_2097152.upload.maximum_size=6287360
challenger_2040_wifi.menu.flash.8388608_2097152.build.flash_length=6287360
challenger_2040_wifi.menu.flash.8388608_2097152.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_2097152.build.fs_start=274722816
challenger_2040_wifi.menu.flash.8388608_2097152.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_3145728=8MB (Sketch: 5MB, FS: 3MB)
challenger_2040_wifi.menu.flash.8388608_3145728.upload.maximum_size=5238784
challenger_2040_wifi.menu.flash.8388608_3145728.build.flash_length=5238784
challenger_2040_wifi.menu.flash.8388608_3145728.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_3145728.build.fs_start=273674240
challenger_2040_wifi.menu.flash.8388608_3145728.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_4194304=8MB (Sketch: 4MB, FS: 4MB)
challenger_2040_wifi.menu.flash.8388608_4194304.upload.maximum_size=4190208
challenger_2040_wifi.menu.flash.8388608_4194304.build.flash_length=4190208
challenger_2040_wifi.menu.flash.8388608_4194304.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_4194304.build.fs_start=272625664
challenger_2040_wifi.menu.flash.8388608_4194304.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_5242880=8MB (Sketch: 3MB, FS: 5MB)
challenger_2040_wifi.menu.flash.8388608_5242880.upload.maximum_size=3141632
challenger_2040_wifi.menu.flash.8388608_5242880.build.flash_length=3141632
challenger_2040_wifi.menu.flash.8388608_5242880.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_5242880.build.fs_start=271577088
challenger_2040_wifi.menu.flash.8388608_5242880.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_6291456=8MB (Sketch: 2MB, FS: 6MB)
challenger_2040_wifi.menu.flash.8388608_6291456.upload.maximum_size=2093056
challenger_2040_wifi.menu.flash.8388608_6291456.build.flash_length=2093056
challenger_2040_wifi.menu.flash.8388608_6291456.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_6291456.build.fs_start=270528512
challenger_2040_wifi.menu.flash.8388608_6291456.build.fs_end=276819968
challenger_2040_wifi.menu.flash.8388608_7340032=8MB (Sketch: 1MB, FS: 7MB)
challenger_2040_wifi.menu.flash.8388608_7340032.upload.maximum_size=1044480
challenger_2040_wifi.menu.flash.8388608_7340032.build.flash_length=1044480
challenger_2040_wifi.menu.flash.8388608_7340032.build.eeprom_start=276819968
challenger_2040_wifi.menu.flash.8388608_7340032.build.fs_start=269479936
challenger_2040_wifi.menu.flash.8388608_7340032.build.fs_end=276819968
challenger_2040_wifi.menu.freq.125=125 MHz
challenger_2040_wifi.menu.freq.125.build.f_cpu=125000000L
challenger_2040_wifi.menu.freq.50=50 MHz
challenger_2040_wifi.menu.freq.50.build.f_cpu=50000000L
challenger_2040_wifi.menu.freq.100=100 MHz
challenger_2040_wifi.menu.freq.100.build.f_cpu=100000000L
challenger_2040_wifi.menu.freq.133=133 MHz
challenger_2040_wifi.menu.freq.133.build.f_cpu=133000000L
challenger_2040_wifi.menu.freq.150=150 MHz (Overclock)
challenger_2040_wifi.menu.freq.150.build.f_cpu=150000000L
challenger_2040_wifi.menu.freq.175=175 MHz (Overclock)
challenger_2040_wifi.menu.freq.175.build.f_cpu=175000000L
challenger_2040_wifi.menu.freq.200=200 MHz (Overclock)
challenger_2040_wifi.menu.freq.200.build.f_cpu=200000000L
challenger_2040_wifi.menu.freq.225=225 MHz (Overclock)
challenger_2040_wifi.menu.freq.225.build.f_cpu=225000000L
challenger_2040_wifi.menu.freq.250=250 MHz (Overclock)
challenger_2040_wifi.menu.freq.250.build.f_cpu=250000000L
challenger_2040_wifi.menu.freq.275=275 MHz (Overclock)
challenger_2040_wifi.menu.freq.275.build.f_cpu=275000000L
challenger_2040_wifi.menu.freq.300=300 MHz (Overclock)
challenger_2040_wifi.menu.freq.300.build.f_cpu=300000000L
challenger_2040_wifi.menu.dbgport.Disabled=Disabled
challenger_2040_wifi.menu.dbgport.Disabled.build.debug_port=
challenger_2040_wifi.menu.dbgport.Serial=Serial
challenger_2040_wifi.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial
challenger_2040_wifi.menu.dbgport.Serial1=Serial1
challenger_2040_wifi.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1
challenger_2040_wifi.menu.dbgport.Serial2=Serial2
challenger_2040_wifi.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2
challenger_2040_wifi.menu.dbglvl.None=None
challenger_2040_wifi.menu.dbglvl.None.build.debug_level=
challenger_2040_wifi.menu.dbglvl.Core=Core
challenger_2040_wifi.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE
challenger_2040_wifi.menu.dbglvl.SPI=SPI
challenger_2040_wifi.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI
challenger_2040_wifi.menu.dbglvl.Wire=Wire
challenger_2040_wifi.menu.dbglvl.Wire.build.debug_level=-DDEBUG_RP2040_WIRE
challenger_2040_wifi.menu.dbglvl.All=All
challenger_2040_wifi.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
challenger_2040_wifi.menu.dbglvl.NDEBUG=NDEBUG
challenger_2040_wifi.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
challenger_2040_wifi.menu.usbstack.picosdk=Pico SDK
challenger_2040_wifi.menu.usbstack.picosdk.build.usbstack_flags="-I{runtime.platform.path}/tools/libpico"
challenger_2040_wifi.menu.usbstack.tinyusb=Adafruit TinyUSB
challenger_2040_wifi.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
# -----------------------------------
# iLabs Challenger 2040 WiFi (Picoprobe)
# -----------------------------------
challenger_2040_wifipicoprobe.name=iLabs Challenger 2040 WiFi (Picoprobe)
challenger_2040_wifipicoprobe.vid.0=0x2e8a
challenger_2040_wifipicoprobe.pid.0=0x0004
challenger_2040_wifipicoprobe.build.usbpid=-DSERIALUSB_PID=0x1006
challenger_2040_wifipicoprobe.build.board=CHALLENGER_2040_WIFI_RP2040
challenger_2040_wifipicoprobe.build.mcu=cortex-m0plus
challenger_2040_wifipicoprobe.build.variant=challenger_2040_wifi
challenger_2040_wifipicoprobe.upload.tool=picoprobe
challenger_2040_wifipicoprobe.upload.maximum_size=8388608
challenger_2040_wifipicoprobe.upload.maximum_data_size=262144
challenger_2040_wifipicoprobe.upload.wait_for_upload_port=true
challenger_2040_wifipicoprobe.upload.erase_cmd=
challenger_2040_wifipicoprobe.serial.disableDTR=false
challenger_2040_wifipicoprobe.serial.disableRTS=false
challenger_2040_wifipicoprobe.build.f_cpu=125000000
challenger_2040_wifipicoprobe.build.led=
challenger_2040_wifipicoprobe.build.core=rp2040
challenger_2040_wifipicoprobe.build.mcu=rp2040
challenger_2040_wifipicoprobe.build.ldscript=memmap_default.ld
challenger_2040_wifipicoprobe.build.ram_length=256k
challenger_2040_wifipicoprobe.build.boot2=boot2_w25q080_4_padded_checksum
challenger_2040_wifipicoprobe.build.vid=0x2e8a
challenger_2040_wifipicoprobe.build.pid=0x1006
challenger_2040_wifipicoprobe.build.usb_manufacturer="iLabs"
challenger_2040_wifipicoprobe.build.usb_product="Challenger 2040 WiFi (Picoprobe)"
challenger_2040_wifipicoprobe.menu.flash.8388608_0=8MB (no FS)
challenger_2040_wifipicoprobe.menu.flash.8388608_0.upload.maximum_size=8384512
challenger_2040_wifipicoprobe.menu.flash.8388608_0.build.flash_length=8384512
challenger_2040_wifipicoprobe.menu.flash.8388608_0.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_0.build.fs_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_0.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_65536=8MB (Sketch: 8128KB, FS: 64KB)
challenger_2040_wifipicoprobe.menu.flash.8388608_65536.upload.maximum_size=8318976
challenger_2040_wifipicoprobe.menu.flash.8388608_65536.build.flash_length=8318976
challenger_2040_wifipicoprobe.menu.flash.8388608_65536.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_65536.build.fs_start=276754432
challenger_2040_wifipicoprobe.menu.flash.8388608_65536.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_131072=8MB (Sketch: 8064KB, FS: 128KB)
challenger_2040_wifipicoprobe.menu.flash.8388608_131072.upload.maximum_size=8253440
challenger_2040_wifipicoprobe.menu.flash.8388608_131072.build.flash_length=8253440
challenger_2040_wifipicoprobe.menu.flash.8388608_131072.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_131072.build.fs_start=276688896
challenger_2040_wifipicoprobe.menu.flash.8388608_131072.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_262144=8MB (Sketch: 7936KB, FS: 256KB)
challenger_2040_wifipicoprobe.menu.flash.8388608_262144.upload.maximum_size=8122368
challenger_2040_wifipicoprobe.menu.flash.8388608_262144.build.flash_length=8122368
challenger_2040_wifipicoprobe.menu.flash.8388608_262144.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_262144.build.fs_start=276557824
challenger_2040_wifipicoprobe.menu.flash.8388608_262144.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_524288=8MB (Sketch: 7680KB, FS: 512KB)
challenger_2040_wifipicoprobe.menu.flash.8388608_524288.upload.maximum_size=7860224
challenger_2040_wifipicoprobe.menu.flash.8388608_524288.build.flash_length=7860224
challenger_2040_wifipicoprobe.menu.flash.8388608_524288.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_524288.build.fs_start=276295680
challenger_2040_wifipicoprobe.menu.flash.8388608_524288.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_1048576=8MB (Sketch: 7MB, FS: 1MB)
challenger_2040_wifipicoprobe.menu.flash.8388608_1048576.upload.maximum_size=7335936
challenger_2040_wifipicoprobe.menu.flash.8388608_1048576.build.flash_length=7335936
challenger_2040_wifipicoprobe.menu.flash.8388608_1048576.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_1048576.build.fs_start=275771392
challenger_2040_wifipicoprobe.menu.flash.8388608_1048576.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_2097152=8MB (Sketch: 6MB, FS: 2MB)
challenger_2040_wifipicoprobe.menu.flash.8388608_2097152.upload.maximum_size=6287360
challenger_2040_wifipicoprobe.menu.flash.8388608_2097152.build.flash_length=6287360
challenger_2040_wifipicoprobe.menu.flash.8388608_2097152.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_2097152.build.fs_start=274722816
challenger_2040_wifipicoprobe.menu.flash.8388608_2097152.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_3145728=8MB (Sketch: 5MB, FS: 3MB)
challenger_2040_wifipicoprobe.menu.flash.8388608_3145728.upload.maximum_size=5238784
challenger_2040_wifipicoprobe.menu.flash.8388608_3145728.build.flash_length=5238784
challenger_2040_wifipicoprobe.menu.flash.8388608_3145728.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_3145728.build.fs_start=273674240
challenger_2040_wifipicoprobe.menu.flash.8388608_3145728.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_4194304=8MB (Sketch: 4MB, FS: 4MB)
challenger_2040_wifipicoprobe.menu.flash.8388608_4194304.upload.maximum_size=4190208
challenger_2040_wifipicoprobe.menu.flash.8388608_4194304.build.flash_length=4190208
challenger_2040_wifipicoprobe.menu.flash.8388608_4194304.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_4194304.build.fs_start=272625664
challenger_2040_wifipicoprobe.menu.flash.8388608_4194304.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_5242880=8MB (Sketch: 3MB, FS: 5MB)
challenger_2040_wifipicoprobe.menu.flash.8388608_5242880.upload.maximum_size=3141632
challenger_2040_wifipicoprobe.menu.flash.8388608_5242880.build.flash_length=3141632
challenger_2040_wifipicoprobe.menu.flash.8388608_5242880.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_5242880.build.fs_start=271577088
challenger_2040_wifipicoprobe.menu.flash.8388608_5242880.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_6291456=8MB (Sketch: 2MB, FS: 6MB)
challenger_2040_wifipicoprobe.menu.flash.8388608_6291456.upload.maximum_size=2093056
challenger_2040_wifipicoprobe.menu.flash.8388608_6291456.build.flash_length=2093056
challenger_2040_wifipicoprobe.menu.flash.8388608_6291456.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_6291456.build.fs_start=270528512
challenger_2040_wifipicoprobe.menu.flash.8388608_6291456.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_7340032=8MB (Sketch: 1MB, FS: 7MB)
challenger_2040_wifipicoprobe.menu.flash.8388608_7340032.upload.maximum_size=1044480
challenger_2040_wifipicoprobe.menu.flash.8388608_7340032.build.flash_length=1044480
challenger_2040_wifipicoprobe.menu.flash.8388608_7340032.build.eeprom_start=276819968
challenger_2040_wifipicoprobe.menu.flash.8388608_7340032.build.fs_start=269479936
challenger_2040_wifipicoprobe.menu.flash.8388608_7340032.build.fs_end=276819968
challenger_2040_wifipicoprobe.menu.freq.125=125 MHz
challenger_2040_wifipicoprobe.menu.freq.125.build.f_cpu=125000000L
challenger_2040_wifipicoprobe.menu.freq.50=50 MHz
challenger_2040_wifipicoprobe.menu.freq.50.build.f_cpu=50000000L
challenger_2040_wifipicoprobe.menu.freq.100=100 MHz
challenger_2040_wifipicoprobe.menu.freq.100.build.f_cpu=100000000L
challenger_2040_wifipicoprobe.menu.freq.133=133 MHz
challenger_2040_wifipicoprobe.menu.freq.133.build.f_cpu=133000000L
challenger_2040_wifipicoprobe.menu.freq.150=150 MHz (Overclock)
challenger_2040_wifipicoprobe.menu.freq.150.build.f_cpu=150000000L
challenger_2040_wifipicoprobe.menu.freq.175=175 MHz (Overclock)
challenger_2040_wifipicoprobe.menu.freq.175.build.f_cpu=175000000L
challenger_2040_wifipicoprobe.menu.freq.200=200 MHz (Overclock)
challenger_2040_wifipicoprobe.menu.freq.200.build.f_cpu=200000000L
challenger_2040_wifipicoprobe.menu.freq.225=225 MHz (Overclock)
challenger_2040_wifipicoprobe.menu.freq.225.build.f_cpu=225000000L
challenger_2040_wifipicoprobe.menu.freq.250=250 MHz (Overclock)
challenger_2040_wifipicoprobe.menu.freq.250.build.f_cpu=250000000L
challenger_2040_wifipicoprobe.menu.freq.275=275 MHz (Overclock)
challenger_2040_wifipicoprobe.menu.freq.275.build.f_cpu=275000000L
challenger_2040_wifipicoprobe.menu.freq.300=300 MHz (Overclock)
challenger_2040_wifipicoprobe.menu.freq.300.build.f_cpu=300000000L
challenger_2040_wifipicoprobe.menu.dbgport.Disabled=Disabled
challenger_2040_wifipicoprobe.menu.dbgport.Disabled.build.debug_port=
challenger_2040_wifipicoprobe.menu.dbgport.Serial=Serial
challenger_2040_wifipicoprobe.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial
challenger_2040_wifipicoprobe.menu.dbgport.Serial1=Serial1
challenger_2040_wifipicoprobe.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1
challenger_2040_wifipicoprobe.menu.dbgport.Serial2=Serial2
challenger_2040_wifipicoprobe.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2
challenger_2040_wifipicoprobe.menu.dbglvl.None=None
challenger_2040_wifipicoprobe.menu.dbglvl.None.build.debug_level=
challenger_2040_wifipicoprobe.menu.dbglvl.Core=Core
challenger_2040_wifipicoprobe.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE
challenger_2040_wifipicoprobe.menu.dbglvl.SPI=SPI
challenger_2040_wifipicoprobe.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI
challenger_2040_wifipicoprobe.menu.dbglvl.Wire=Wire
challenger_2040_wifipicoprobe.menu.dbglvl.Wire.build.debug_level=-DDEBUG_RP2040_WIRE
challenger_2040_wifipicoprobe.menu.dbglvl.All=All
challenger_2040_wifipicoprobe.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
challenger_2040_wifipicoprobe.menu.dbglvl.NDEBUG=NDEBUG
challenger_2040_wifipicoprobe.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
challenger_2040_wifipicoprobe.menu.usbstack.picosdk=Pico SDK
challenger_2040_wifipicoprobe.menu.usbstack.picosdk.build.usbstack_flags="-I{runtime.platform.path}/tools/libpico"
challenger_2040_wifipicoprobe.menu.usbstack.tinyusb=Adafruit TinyUSB
challenger_2040_wifipicoprobe.menu.usbstack.tinyusb.build.usbstack_flags=-DUSE_TINYUSB "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino"
# -----------------------------------
# iLabs Challenger 2040 WiFi (pico-debug)
# -----------------------------------
challenger_2040_wifipicodebug.name=iLabs Challenger 2040 WiFi (pico-debug)
challenger_2040_wifipicodebug.vid.0=0x1209
challenger_2040_wifipicodebug.pid.0=0x2488
challenger_2040_wifipicodebug.build.usbpid=-DSERIALUSB_PID=0x1006
challenger_2040_wifipicodebug.build.board=CHALLENGER_2040_WIFI_RP2040
challenger_2040_wifipicodebug.build.mcu=cortex-m0plus
challenger_2040_wifipicodebug.build.variant=challenger_2040_wifi
challenger_2040_wifipicodebug.upload.tool=picodebug
challenger_2040_wifipicodebug.upload.maximum_size=8388608
challenger_2040_wifipicodebug.upload.maximum_data_size=245760
challenger_2040_wifipicodebug.upload.wait_for_upload_port=true
challenger_2040_wifipicodebug.upload.erase_cmd=
challenger_2040_wifipicodebug.serial.disableDTR=false
challenger_2040_wifipicodebug.serial.disableRTS=false
challenger_2040_wifipicodebug.build.f_cpu=125000000
challenger_2040_wifipicodebug.build.led=
challenger_2040_wifipicodebug.build.core=rp2040
challenger_2040_wifipicodebug.build.mcu=rp2040
challenger_2040_wifipicodebug.build.ldscript=memmap_default.ld
challenger_2040_wifipicodebug.build.ram_length=240k
challenger_2040_wifipicodebug.build.boot2=boot2_w25q080_4_padded_checksum
challenger_2040_wifipicodebug.build.vid=0x2e8a
challenger_2040_wifipicodebug.build.pid=0x1006
challenger_2040_wifipicodebug.build.usb_manufacturer="iLabs"
challenger_2040_wifipicodebug.build.usb_product="Challenger 2040 WiFi (pico-debug)"
challenger_2040_wifipicodebug.menu.flash.8388608_0=8MB (no FS)
challenger_2040_wifipicodebug.menu.flash.8388608_0.upload.maximum_size=8384512
challenger_2040_wifipicodebug.menu.flash.8388608_0.build.flash_length=8384512
challenger_2040_wifipicodebug.menu.flash.8388608_0.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_0.build.fs_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_0.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_65536=8MB (Sketch: 8128KB, FS: 64KB)
challenger_2040_wifipicodebug.menu.flash.8388608_65536.upload.maximum_size=8318976
challenger_2040_wifipicodebug.menu.flash.8388608_65536.build.flash_length=8318976
challenger_2040_wifipicodebug.menu.flash.8388608_65536.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_65536.build.fs_start=276754432
challenger_2040_wifipicodebug.menu.flash.8388608_65536.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_131072=8MB (Sketch: 8064KB, FS: 128KB)
challenger_2040_wifipicodebug.menu.flash.8388608_131072.upload.maximum_size=8253440
challenger_2040_wifipicodebug.menu.flash.8388608_131072.build.flash_length=8253440
challenger_2040_wifipicodebug.menu.flash.8388608_131072.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_131072.build.fs_start=276688896
challenger_2040_wifipicodebug.menu.flash.8388608_131072.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_262144=8MB (Sketch: 7936KB, FS: 256KB)
challenger_2040_wifipicodebug.menu.flash.8388608_262144.upload.maximum_size=8122368
challenger_2040_wifipicodebug.menu.flash.8388608_262144.build.flash_length=8122368
challenger_2040_wifipicodebug.menu.flash.8388608_262144.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_262144.build.fs_start=276557824
challenger_2040_wifipicodebug.menu.flash.8388608_262144.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_524288=8MB (Sketch: 7680KB, FS: 512KB)
challenger_2040_wifipicodebug.menu.flash.8388608_524288.upload.maximum_size=7860224
challenger_2040_wifipicodebug.menu.flash.8388608_524288.build.flash_length=7860224
challenger_2040_wifipicodebug.menu.flash.8388608_524288.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_524288.build.fs_start=276295680
challenger_2040_wifipicodebug.menu.flash.8388608_524288.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_1048576=8MB (Sketch: 7MB, FS: 1MB)
challenger_2040_wifipicodebug.menu.flash.8388608_1048576.upload.maximum_size=7335936
challenger_2040_wifipicodebug.menu.flash.8388608_1048576.build.flash_length=7335936
challenger_2040_wifipicodebug.menu.flash.8388608_1048576.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_1048576.build.fs_start=275771392
challenger_2040_wifipicodebug.menu.flash.8388608_1048576.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_2097152=8MB (Sketch: 6MB, FS: 2MB)
challenger_2040_wifipicodebug.menu.flash.8388608_2097152.upload.maximum_size=6287360
challenger_2040_wifipicodebug.menu.flash.8388608_2097152.build.flash_length=6287360
challenger_2040_wifipicodebug.menu.flash.8388608_2097152.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_2097152.build.fs_start=274722816
challenger_2040_wifipicodebug.menu.flash.8388608_2097152.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_3145728=8MB (Sketch: 5MB, FS: 3MB)
challenger_2040_wifipicodebug.menu.flash.8388608_3145728.upload.maximum_size=5238784
challenger_2040_wifipicodebug.menu.flash.8388608_3145728.build.flash_length=5238784
challenger_2040_wifipicodebug.menu.flash.8388608_3145728.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_3145728.build.fs_start=273674240
challenger_2040_wifipicodebug.menu.flash.8388608_3145728.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_4194304=8MB (Sketch: 4MB, FS: 4MB)
challenger_2040_wifipicodebug.menu.flash.8388608_4194304.upload.maximum_size=4190208
challenger_2040_wifipicodebug.menu.flash.8388608_4194304.build.flash_length=4190208
challenger_2040_wifipicodebug.menu.flash.8388608_4194304.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_4194304.build.fs_start=272625664
challenger_2040_wifipicodebug.menu.flash.8388608_4194304.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_5242880=8MB (Sketch: 3MB, FS: 5MB)
challenger_2040_wifipicodebug.menu.flash.8388608_5242880.upload.maximum_size=3141632
challenger_2040_wifipicodebug.menu.flash.8388608_5242880.build.flash_length=3141632
challenger_2040_wifipicodebug.menu.flash.8388608_5242880.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_5242880.build.fs_start=271577088
challenger_2040_wifipicodebug.menu.flash.8388608_5242880.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_6291456=8MB (Sketch: 2MB, FS: 6MB)
challenger_2040_wifipicodebug.menu.flash.8388608_6291456.upload.maximum_size=2093056
challenger_2040_wifipicodebug.menu.flash.8388608_6291456.build.flash_length=2093056
challenger_2040_wifipicodebug.menu.flash.8388608_6291456.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_6291456.build.fs_start=270528512
challenger_2040_wifipicodebug.menu.flash.8388608_6291456.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_7340032=8MB (Sketch: 1MB, FS: 7MB)
challenger_2040_wifipicodebug.menu.flash.8388608_7340032.upload.maximum_size=1044480
challenger_2040_wifipicodebug.menu.flash.8388608_7340032.build.flash_length=1044480
challenger_2040_wifipicodebug.menu.flash.8388608_7340032.build.eeprom_start=276819968
challenger_2040_wifipicodebug.menu.flash.8388608_7340032.build.fs_start=269479936
challenger_2040_wifipicodebug.menu.flash.8388608_7340032.build.fs_end=276819968
challenger_2040_wifipicodebug.menu.freq.125=125 MHz
challenger_2040_wifipicodebug.menu.freq.125.build.f_cpu=125000000L
challenger_2040_wifipicodebug.menu.freq.50=50 MHz
challenger_2040_wifipicodebug.menu.freq.50.build.f_cpu=50000000L
challenger_2040_wifipicodebug.menu.freq.100=100 MHz
challenger_2040_wifipicodebug.menu.freq.100.build.f_cpu=100000000L
challenger_2040_wifipicodebug.menu.freq.133=133 MHz
challenger_2040_wifipicodebug.menu.freq.133.build.f_cpu=133000000L
challenger_2040_wifipicodebug.menu.freq.150=150 MHz (Overclock)
challenger_2040_wifipicodebug.menu.freq.150.build.f_cpu=150000000L
challenger_2040_wifipicodebug.menu.freq.175=175 MHz (Overclock)
challenger_2040_wifipicodebug.menu.freq.175.build.f_cpu=175000000L
challenger_2040_wifipicodebug.menu.freq.200=200 MHz (Overclock)
challenger_2040_wifipicodebug.menu.freq.200.build.f_cpu=200000000L
challenger_2040_wifipicodebug.menu.freq.225=225 MHz (Overclock)
challenger_2040_wifipicodebug.menu.freq.225.build.f_cpu=225000000L
challenger_2040_wifipicodebug.menu.freq.250=250 MHz (Overclock)
challenger_2040_wifipicodebug.menu.freq.250.build.f_cpu=250000000L
challenger_2040_wifipicodebug.menu.freq.275=275 MHz (Overclock)
challenger_2040_wifipicodebug.menu.freq.275.build.f_cpu=275000000L
challenger_2040_wifipicodebug.menu.freq.300=300 MHz (Overclock)
challenger_2040_wifipicodebug.menu.freq.300.build.f_cpu=300000000L
challenger_2040_wifipicodebug.menu.dbgport.Disabled=Disabled
challenger_2040_wifipicodebug.menu.dbgport.Disabled.build.debug_port=
challenger_2040_wifipicodebug.menu.dbgport.Serial=Serial
challenger_2040_wifipicodebug.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial
challenger_2040_wifipicodebug.menu.dbgport.Serial1=Serial1
challenger_2040_wifipicodebug.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1
challenger_2040_wifipicodebug.menu.dbgport.Serial2=Serial2
challenger_2040_wifipicodebug.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2
challenger_2040_wifipicodebug.menu.dbglvl.None=None
challenger_2040_wifipicodebug.menu.dbglvl.None.build.debug_level=
challenger_2040_wifipicodebug.menu.dbglvl.Core=Core
challenger_2040_wifipicodebug.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE
challenger_2040_wifipicodebug.menu.dbglvl.SPI=SPI
challenger_2040_wifipicodebug.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI
challenger_2040_wifipicodebug.menu.dbglvl.Wire=Wire
challenger_2040_wifipicodebug.menu.dbglvl.Wire.build.debug_level=-DDEBUG_RP2040_WIRE
challenger_2040_wifipicodebug.menu.dbglvl.All=All
challenger_2040_wifipicodebug.menu.dbglvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE
challenger_2040_wifipicodebug.menu.dbglvl.NDEBUG=NDEBUG
challenger_2040_wifipicodebug.menu.dbglvl.NDEBUG.build.debug_level=-DNDEBUG
challenger_2040_wifipicodebug.menu.usbstack.nousb=No USB
challenger_2040_wifipicodebug.menu.usbstack.nousb.build.usbstack_flags="-DNO_USB -DDISABLE_USB_SERIAL -I{runtime.platform.path}/tools/libpico"
+50 -31
View File
@@ -122,32 +122,48 @@ int __USBGetMouseReportID() {
}
static uint8_t *GetDescHIDReport(int *len) {
static uint8_t *report = nullptr;
int report_len = 0;
if (report) {
free(report);
report = nullptr;
}
if (__USBInstallKeyboard && __USBInstallMouse) {
static uint8_t desc_hid_report[] = {
uint8_t desc_hid_report[] = {
TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(1)),
TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(2))
};
if (len) {
*len = sizeof(desc_hid_report);
report_len = sizeof(desc_hid_report);
report = (uint8_t *)malloc(report_len);
if (report) {
memcpy(report, desc_hid_report, report_len);
}
return desc_hid_report;
} else if (__USBInstallKeyboard && ! __USBInstallMouse) {
static uint8_t desc_hid_report[] = {
uint8_t desc_hid_report[] = {
TUD_HID_REPORT_DESC_KEYBOARD(HID_REPORT_ID(1))
};
if (len) {
*len = sizeof(desc_hid_report);
report_len = sizeof(desc_hid_report);
report = (uint8_t *)malloc(report_len);
if (report) {
memcpy(report, desc_hid_report, report_len);
}
return desc_hid_report;
} else { // if (!__USBInstallKeyboard && __USBInstallMouse) {
static uint8_t desc_hid_report[] = {
uint8_t desc_hid_report[] = {
TUD_HID_REPORT_DESC_MOUSE(HID_REPORT_ID(1))
};
if (len) {
*len = sizeof(desc_hid_report);
report_len = sizeof(desc_hid_report);
report = (uint8_t *)malloc(report_len);
if (report) {
memcpy(report, desc_hid_report, report_len);
}
return desc_hid_report;
}
if (len) {
*len = report_len;
}
return report;
}
// Invoked when received GET HID REPORT DESCRIPTOR
@@ -161,14 +177,14 @@ uint8_t const * tud_hid_descriptor_report_cb(uint8_t instance) {
const uint8_t *tud_descriptor_configuration_cb(uint8_t index) {
(void)index;
static uint8_t *usbd_desc_cfg = NULL;
static uint8_t *usbd_desc_cfg = nullptr;
if (!usbd_desc_cfg) {
bool hasHID = __USBInstallKeyboard || __USBInstallMouse;
uint8_t interface_count = (__USBInstallSerial ? 2 : 0) + (hasHID ? 1 : 0) + (__USBInstallMIDI ? 2 : 0);
static uint8_t cdc_desc[TUD_CDC_DESC_LEN] = {
uint8_t cdc_desc[TUD_CDC_DESC_LEN] = {
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
TUD_CDC_DESCRIPTOR(USBD_ITF_CDC, USBD_STR_CDC, USBD_CDC_EP_CMD, USBD_CDC_CMD_MAX_SIZE, USBD_CDC_EP_OUT, USBD_CDC_EP_IN, USBD_CDC_IN_OUT_MAX_SIZE)
};
@@ -176,40 +192,42 @@ const uint8_t *tud_descriptor_configuration_cb(uint8_t index) {
int hid_report_len;
GetDescHIDReport(&hid_report_len);
uint8_t hid_itf = __USBInstallSerial ? 2 : 0;
static uint8_t hid_desc[TUD_HID_DESC_LEN] = {
uint8_t hid_desc[TUD_HID_DESC_LEN] = {
// Interface number, string index, protocol, report descriptor len, EP In & Out address, size & polling interval
TUD_HID_DESCRIPTOR(hid_itf, 0, HID_ITF_PROTOCOL_NONE, hid_report_len, EPNUM_HID, CFG_TUD_HID_EP_BUFSIZE, 10)
};
uint8_t midi_itf = hid_itf + (hasHID ? 1 : 0);
static uint8_t midi_desc[TUD_MIDI_DESC_LEN] = {
uint8_t midi_desc[TUD_MIDI_DESC_LEN] = {
// Interface number, string index, EP Out & EP In address, EP size
TUD_MIDI_DESCRIPTOR(midi_itf, 0, EPNUM_MIDI, 0x80 | EPNUM_MIDI, 64)
};
int usbd_desc_len = TUD_CONFIG_DESC_LEN + (__USBInstallSerial ? sizeof(cdc_desc) : 0) + (hasHID ? sizeof(hid_desc) : 0) + (__USBInstallMIDI ? sizeof(midi_desc) : 0);
static uint8_t tud_cfg_desc[TUD_CONFIG_DESC_LEN] = {
uint8_t tud_cfg_desc[TUD_CONFIG_DESC_LEN] = {
// Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(1, interface_count, USBD_STR_0, usbd_desc_len, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, USBD_MAX_POWER_MA)
};
// Combine to one descriptor
usbd_desc_cfg = (uint8_t *)malloc(usbd_desc_len);
bzero(usbd_desc_cfg, usbd_desc_len);
uint8_t *ptr = usbd_desc_cfg;
memcpy(ptr, tud_cfg_desc, sizeof(tud_cfg_desc));
ptr += sizeof(tud_cfg_desc);
if (__USBInstallSerial) {
memcpy(ptr, cdc_desc, sizeof(cdc_desc));
ptr += sizeof(cdc_desc);
}
if (hasHID) {
memcpy(ptr, hid_desc, sizeof(hid_desc));
ptr += sizeof(hid_desc);
}
if (__USBInstallMIDI) {
memcpy(ptr, midi_desc, sizeof(midi_desc));
if (usbd_desc_cfg) {
bzero(usbd_desc_cfg, usbd_desc_len);
uint8_t *ptr = usbd_desc_cfg;
memcpy(ptr, tud_cfg_desc, sizeof(tud_cfg_desc));
ptr += sizeof(tud_cfg_desc);
if (__USBInstallSerial) {
memcpy(ptr, cdc_desc, sizeof(cdc_desc));
ptr += sizeof(cdc_desc);
}
if (hasHID) {
memcpy(ptr, hid_desc, sizeof(hid_desc));
ptr += sizeof(hid_desc);
}
if (__USBInstallMIDI) {
memcpy(ptr, midi_desc, sizeof(midi_desc));
}
}
}
return usbd_desc_cfg;
@@ -277,6 +295,7 @@ void __USBStart() {
}
mutex_init(&__usb_mutex);
tusb_init();
irq_set_exclusive_handler(USB_TASK_IRQ, usb_irq);
+1 -1
View File
@@ -76,7 +76,7 @@ extern "C" int main() {
#endif
#if defined DEBUG_RP2040_PORT
DEBUG_RP2040_PORT.begin();
DEBUG_RP2040_PORT.begin(115200);
#endif
#ifndef NO_USB
+20
View File
@@ -30,6 +30,8 @@ static uint32_t analogScale = 255;
static uint16_t analogFreq = 1000;
static bool pwmInitted = false;
static bool adcInitted = false;
static uint16_t analogWritePseudoScale = 1;
static uint16_t analogWriteSlowScale = 1;
auto_init_mutex(_dacMutex);
@@ -77,6 +79,21 @@ extern "C" void analogWrite(pin_size_t pin, int val) {
return;
}
if (!pwmInitted) {
// For low frequencies, we need to scale the output max value up to achieve lower periods
analogWritePseudoScale = 1;
while (((clock_get_hz(clk_sys) / (float)(analogScale * analogFreq)) > 255.0) && (analogScale < 32678)) {
analogWritePseudoScale++;
analogScale *= 2;
DEBUGCORE("Adjusting analogWrite values PS=%d, scale=%d\n", analogWritePseudoScale, analogScale);
}
// For high frequencies, we need to scale the output max value down to actually hit the frequency target
analogWriteSlowScale = 1;
while (((clock_get_hz(clk_sys) / (float)(analogScale * analogFreq)) < 2.0) && (analogScale > 32)) {
analogWriteSlowScale++;
analogScale /= 2;
DEBUGCORE("Adjusting analogWrite values SS=%d, scale=%d\n", analogWriteSlowScale, analogScale);
}
pwm_config c = pwm_get_default_config();
pwm_config_set_clkdiv(&c, clock_get_hz(clk_sys) / (float)(analogScale * analogFreq));
pwm_config_set_wrap(&c, analogScale);
@@ -86,6 +103,9 @@ extern "C" void analogWrite(pin_size_t pin, int val) {
pwmInitted = true;
}
val <<= analogWritePseudoScale;
val >>= analogWriteSlowScale;
if (val < 0) {
val = 0;
} else if ((uint32_t)val > analogScale) {
+1
View File
@@ -33,6 +33,7 @@ SPI (SPI0), SPI1 (SPI1)
.. code:: cpp
::setSCK(pin)
::setCS(pin)
::setRX(pin)
::setTX(pin)
BIN
View File
Binary file not shown.
+3
View File
@@ -176,6 +176,9 @@ public:
}
bool begin() override {
if (_mounted) {
return true;
}
if (_size <= 0) {
DEBUGV("LittleFS size is <= zero");
return false;
+1 -1
View File
@@ -148,7 +148,7 @@ public:
bool begin() override {
if (_mounted) {
end();
return true;
}
_mounted = _fs.begin(_cfg._csPin, _cfg._spiSettings);
if (!_mounted && _cfg._autoFormat) {
@@ -192,6 +192,7 @@ void TwoWire::beginTransmission(uint8_t addr) {
}
_addr = addr;
_buffLen = 0;
_buffOff = 0;
_txBegun = true;
}
@@ -200,7 +201,10 @@ size_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) {
return 0;
}
_buffLen = i2c_read_blocking_until(_i2c, address, _buff, quantity, !stopBit, make_timeout_time_ms(50));
_buffLen = i2c_read_blocking_until(_i2c, address, _buff, quantity, !stopBit, make_timeout_time_ms(_timeout));
if (_buffLen == PICO_ERROR_GENERIC) {
_buffLen = 0;
}
_buffOff = 0;
return _buffLen;
}
@@ -288,7 +292,7 @@ uint8_t TwoWire::endTransmission(bool stopBit) {
return _probe(_addr, _sda, _scl, _clkHz) ? 0 : 2;
} else {
auto len = _buffLen;
auto ret = i2c_write_blocking_until(_i2c, _addr, _buff, _buffLen, !stopBit, make_timeout_time_ms(50));
auto ret = i2c_write_blocking_until(_i2c, _addr, _buff, _buffLen, !stopBit, make_timeout_time_ms(_timeout));
_buffLen = 0;
return (ret == len) ? 0 : 4;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "framework-arduinopico",
"description": "Arduino Wiring-based Framework (RPi Pico RP2040)",
"url": "https://github.com/esrlephilhower/arduino-pico",
"url": "https://github.com/earlephilhower/arduino-pico",
"version": "0.9.2"
}
+7 -6
View File
@@ -43,6 +43,7 @@ compiler.includes="-iprefix{runtime.platform.path}/" "@{runtime.platform.path}/l
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"
compiler.libpico="{runtime.platform.path}/lib/libpico.a"
compiler.libstdcpp="{runtime.platform.path}/lib/libstdc++.a"
compiler.c.cmd=arm-none-eabi-gcc
compiler.c.flags=-c {compiler.warning_flags} {compiler.defines} {compiler.flags} {compiler.includes} -std=gnu17 -g
@@ -86,7 +87,7 @@ build.usbstack_flags=
build.boot2=boot2_generic_03h_4_padded_checksum
# Allow Pico boards do be auto-discovered by the IDE
discovery.rp2040.pattern="{runtime.tools.pqt-python3.path}/python3" "{runtime.platform.path}/tools/discovery.py"
discovery.rp2040.pattern="{runtime.tools.pqt-python3.path}/python3" -I "{runtime.platform.path}/tools/discovery.py"
# Compile patterns
@@ -107,13 +108,13 @@ archive_file_path={build.path}/{archive_file}
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
## Generate the linker map with specific flash sizes/locations
recipe.hooks.linking.prelink.1.pattern="{runtime.tools.pqt-python3.path}/python3" "{runtime.platform.path}/tools/simplesub.py" --input "{runtime.platform.path}/lib/memmap_default.ld" --out "{build.path}/memmap_default.ld" --sub __FLASH_LENGTH__ {build.flash_length} --sub __EEPROM_START__ {build.eeprom_start} --sub __FS_START__ {build.fs_start} --sub __FS_END__ {build.fs_end} --sub __RAM_LENGTH__ {build.ram_length}
recipe.hooks.linking.prelink.1.pattern="{runtime.tools.pqt-python3.path}/python3" -I "{runtime.platform.path}/tools/simplesub.py" --input "{runtime.platform.path}/lib/memmap_default.ld" --out "{build.path}/memmap_default.ld" --sub __FLASH_LENGTH__ {build.flash_length} --sub __EEPROM_START__ {build.eeprom_start} --sub __FS_START__ {build.fs_start} --sub __FS_END__ {build.fs_end} --sub __RAM_LENGTH__ {build.ram_length}
## Compile the boot stage 2 blob
recipe.hooks.linking.prelink.2.pattern="{compiler.path}{compiler.S.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -c "{runtime.platform.path}/boot2/{build.boot2}.S" "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/" "-I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include" -o "{build.path}/boot2.o"
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {compiler.ldflags} "-Wl,--script={build.path}/memmap_default.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{build.path}/{archive_file}" "{build.path}/boot2.o" {compiler.libpico} -lm -lc -lstdc++ -lc -Wl,--end-group
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {compiler.ldflags} "-Wl,--script={build.path}/memmap_default.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{build.path}/{archive_file}" "{build.path}/boot2.o" {compiler.libpico} -lm -lc {compiler.libstdcpp} -lc -Wl,--end-group
## Create output (UF2 file)
recipe.objcopy.uf2.pattern="{runtime.tools.pqt-elf2uf2.path}/elf2uf2" "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.uf2"
@@ -138,7 +139,7 @@ tools.uf2conv.cmd={runtime.platform.path}/system/python3/python3
tools.uf2conv.upload.protocol=uf2
tools.uf2conv.upload.params.verbose=
tools.uf2conv.upload.params.quiet=
tools.uf2conv.upload.pattern="{cmd}" "{runtime.platform.path}/tools/uf2conv.py" --serial "{serial.port}" --family RP2040 --deploy "{build.path}/{build.project_name}.uf2"
tools.uf2conv.upload.pattern="{cmd}" -I "{runtime.platform.path}/tools/uf2conv.py" --serial "{serial.port}" --family RP2040 --deploy "{build.path}/{build.project_name}.uf2"
#tools.picoprobe.cmd={runtime.tools.pqt-openocd.path}
@@ -146,10 +147,10 @@ tools.picoprobe.cmd={runtime.platform.path}/system/openocd
tools.picoprobe.upload.protocol=picoprobe
tools.picoprobe.upload.params.verbose=
tools.picoprobe.upload.params.quiet=
tools.picoprobe.upload.pattern="{cmd}/bin/openocd" -f "interface/picoprobe.cfg" -f "target/rp2040.cfg" -s "{cmd}/share/openocd/scripts" -c "program {build.path}/{build.project_name}.elf verify reset exit"
tools.picoprobe.upload.pattern="{cmd}/bin/openocd" -f "interface/picoprobe.cfg" -f "target/rp2040.cfg" -s "{cmd}/share/openocd/scripts" -c "program {{build.path}/{build.project_name}.elf} verify reset exit"
tools.picodebug.cmd={runtime.platform.path}/system/openocd
tools.picodebug.upload.protocol=pico-debug
tools.picodebug.upload.params.verbose=
tools.picodebug.upload.params.quiet=
tools.picodebug.upload.pattern="{cmd}/bin/openocd" -f "board/pico-debug.cfg" -s "{cmd}/share/openocd/scripts" -c "program {build.path}/{build.project_name}.elf verify reset exit"
tools.picodebug.upload.pattern="{cmd}/bin/openocd" -f "board/pico-debug.cfg" -s "{cmd}/share/openocd/scripts" -c "program {{build.path}/{build.project_name}.elf} verify reset exit"
+1 -1
View File
@@ -143,4 +143,4 @@ MakeBoard("adafruit_macropad2040", "Adafruit", "MacroPad RP2040", "0x239a", "0x8
MakeBoard("arduino_nano_connect", "Arduino", "Nano RP2040 Connect", "0x2341", "0x0058", "ARDUINO_NANO_RP2040_CONNECT", 16, "boot2_w25q080_2_padded_checksum")
MakeBoard("sparkfun_promicrorp2040", "SparkFun", "ProMicro RP2040", "0x1b4f", "0x0026", "SPARKFUN_PROMICRO_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
MakeBoard("generic", "Generic", "RP2040", "0x2e8a", "0xf00a", "GENERIC_RP2040", 16, "boot2_generic_03h_4_padded_checksum")
MakeBoard("challenger_2040_wifi", "iLabs", "Challenger 2040 WiFi", "0x2e8a", "0x1006", "CHALLENGER_2040_WIFI_RP2040", 8, "boot2_w25q080_4_padded_checksum")
@@ -0,0 +1,71 @@
#pragma once
#define PINS_COUNT (24u)
#define NUM_DIGITAL_PINS (24u)
#define NUM_ANALOG_INPUTS (4u)
#define NUM_ANALOG_OUTPUTS (0u)
#define ADC_RESOLUTION (12u)
// LEDs
#define PIN_LED (12u)
// Serial
#define PIN_SERIAL1_TX (16u)
#define PIN_SERIAL1_RX (17u)
// Connected to ESP8285
#define PIN_SERIAL2_TX (4u)
#define PIN_SERIAL2_RX (5u)
// SPI
#define PIN_SPI0_MISO (24u)
#define PIN_SPI0_MOSI (23u)
#define PIN_SPI0_SCK (22u)
#define PIN_SPI0_SS (21u)
// Not pinned out
#define PIN_SPI1_MISO (31u)
#define PIN_SPI1_MOSI (31u)
#define PIN_SPI1_SCK (31u)
#define PIN_SPI1_SS (31u)
// Wire
#define PIN_WIRE0_SDA (0u)
#define PIN_WIRE0_SCL (1u)
// Not pinned out
#define PIN_WIRE1_SDA (31u)
#define PIN_WIRE1_SCL (31u)
#define SERIAL_HOWMANY (2u)
#define SPI_HOWMANY (1u)
#define WIRE_HOWMANY (1u)
#define LED_BUILTIN PIN_LED
#define NEOPIXEL (11u)
static const uint8_t D0 = (16u);
static const uint8_t D1 = (17u);
static const uint8_t D2 = (24u);
static const uint8_t D3 = (23u);
static const uint8_t D4 = (22u);
static const uint8_t D5 = (2u);
static const uint8_t D6 = (3u);
static const uint8_t D7 = (0u);
static const uint8_t D8 = (1u);
static const uint8_t D9 = (6u);
static const uint8_t D10 = (7u);
static const uint8_t D11 = (8u);
static const uint8_t D12 = (9u);
static const uint8_t D13 = (10u);
static const uint8_t D14 = (11u);
static const uint8_t D15 = (12u);
static const uint8_t D16 = (13u);
static const uint8_t D17 = (19u);
static const uint8_t A0 = (26u);
static const uint8_t A1 = (27u);
static const uint8_t A2 = (28u);
static const uint8_t A3 = (29u);
static const uint8_t A4 = (25u);
static const uint8_t A5 = (21u);