diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..cae4ba208 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ + +.DS_Store +system +tools/dist +cores/rp2040/api diff --git a/README.md b/README.md index d6585db46..fe475e796 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# Arduino-Pico +# Arduino-Pico [![Join the chat at https://gitter.im/arduino-pico/community](https://badges.gitter.im/arduino-pico/community.svg)](https://gitter.im/arduino-pico/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + + + Raspberry Pi Pico Arduino core, for all RP2040 boards This is a port of the RP2040 (Raspberry Pi Pico processor) to the Arduino ecosystem. @@ -8,11 +11,18 @@ It uses a custom toolset with GCC 10.2 and Newlib 4.0.0, not depending on system There is automated discovery of boards in bootloader mode, so they show up in the IDE, and the upload command works using the Microsoft UF2 tool (included). # Installing via Arduino Boards Manager +**Windows Users**: Please do not use the Windows Store version of the actual Arduino application +because it has issues detecting attached Pico boards. Use the "Windows ZIP" or plain "Windows" +executable (EXE) download direct from https://arduino.cc. and allow it to install any device +drivers it suggests. Otherwise the Pico board may not be detected. Also, if trying out the +2.0 beta Arduino please install the release 1.8 version beforehand to ensure needed device drivers +are present. (See #20 for more details.) + Open up the Arduino IDE and go to File->Preferences. In the dialog that pops up, enter the following URL in the "Additional Boards Manager URLs" field: -https://github.com/earlephilhower/arduino-pico/releases/download/0.9.0/package_rp2040_index.json +https://github.com/wemakerspace/arduino-pico/releases/download/global/package_rp2040_index.json ![image](https://user-images.githubusercontent.com/11875/111917251-3c57f400-8a3c-11eb-8120-810a8328ab3f.png) @@ -24,22 +34,70 @@ Type "pico" in the search box and select "Add": ![image](https://user-images.githubusercontent.com/11875/111917223-12063680-8a3c-11eb-8884-4f32b8f0feb1.png) -# Installing via GIT -To install via GIT (for latest and greatest versions): -```` -mkdir -p ~/Arduino/hardware/pico -git clone https://github.com/earlephilhower/arduino-pico.git ~/Arduino/hardware/pico/rp2040 -cd ~/Arduino/hardware/pico/rp2040 -git submodule init -git submodule update -cd pico-sdk -git submodule init -git submodule update -cd ../tools -python3 ./get.py -````` +# Maker Pi Pico - ESP-01 - Blynk Example + +![image](https://user-images.githubusercontent.com/51473817/112925025-c3475380-9143-11eb-9564-7d2137f50219.png) + +Maker Pi Pico is simple breakout board for Raspberry Pi Pico. + +There is a ESP-01 header that connect to UART0 (Pin 16, 17), you can plug in a normal ESP-01 (AT command SDK) to connect to WiFi. + +You can download the Maker Pi Pico Example to connect to your WiFi and Blynk Server. + +https://github.com/wemakerspace/arduino-pico/releases/download/global/Maker_Pi_Pico_Example_Sketch.zip + +Locate where is the Arduino Sketchbook folder in your Arduino Preference: + +![image](https://user-images.githubusercontent.com/51473817/112761298-3ca05280-902d-11eb-8862-0afde0baea52.png) + +Copy the example arduino sketch and Blynk libraries to the Arduino Sketchbook directory. + +Install the ESP-01 module accordingly to the Maker Pi Pico board. + +Open the Maker_Pi_Pico_Blynk_Example.ino and you should able to compile and upload to Maker Pi Pico. + +Plug in the ESP-01 into the Maker Pi Pico + +Ensure Board Selection is Raspberry Pi Pico, with debug port as `Serial` (Serial = USB CDC, Serial1 = UART0, Serial2 = UART1) + +Go to File -> Example -> rp2040 and select The Maker Pi Pico demo + +# Basic Blynk Support +Download and register account for Blynk mobile App. + +Get the Blynk AUTH TOKEN from email and paste it into the example sketch. + +Enter your WIFI SSID and PASSWORD into the example sketch. + +Select GENERIC BOARD as your board in Blynk App, you can create a button on Pin 25 to test the build in LED. + +Select the correct Port for your Maker Pi Pico. + +Upload the code and open serial monitor to see the Wifi connection status. + + +# Installing both Arduino and CMake +Tom's Hardware presented a very nice writeup on installing `arduino-pico` on both Windows and Linux, available at https://www.tomshardware.com/how-to/program-raspberry-pi-pico-with-arduino-ide + +If you follow Les' step-by-step you will also have a fully functional `CMake`-based environment to build Pico apps on if you outgrow the Arduino ecosystem. + +# Uploading Sketches +To upload your first sketch, you will need to hold the BOOTSEL button down while plugging in the Pico to your computer. +Then hit the upload button and the sketch should be transferred and start to run. + +After the first upload, this should not be necessary as the `arduino-pico` core has auto-reset support. +Select the appropriate serial port shown in the Arduino Tools->Port->Serial Port menu once (this setting will stick and does not need to be +touched for multiple uploads). This selection allows the auto-reset tool to identify the proper device to reset. +Them hit the upload button and your sketch should upload and run. + +In some cases the Pico will encounter a hard hang and its USB port will not respond to the auto-reset request. Should this happen, just +follow the initial procedure of holding the BOOTSEL button down while plugging in the Pico to enter the ROM bootloader. # Status of Port +Added support for Cytron Maker Pi Pico (UART0 Change from GP00,GP01 to GP16,GP17) + +Added Blynk support + Lots of things are working now! * digitalWrite/Read (basic sanity tested) * shiftIn/Out (tested using Nokia5110 https://github.com/ionpan/Nokia5110) @@ -51,11 +109,22 @@ Lots of things are working now! * USB Serial(ACM) w/automatic reboot-to-UF2 upload) * Hardware UART * Servo (basic waveform testing, disables/re-enables without any short pulses) +* printf (i.e. debug) output over USB serial The RP2040 PIO state machines (SMs) are used to generate jitter-free: * Servos * Tones +# Todo +Some major features I want to add are: +* Installable filesystem support (SD, LittleFS, etc.) +* Updated debug infrastructure +* I2S port from pico-extras + +# Tutorials from Across the Web +Here are some links to coverage and additional tutorials for using `arduino-pico` +* Arduino Support for the Pi Pico available! And how fast is the Pico? - https://youtu.be/-XHh17cuH5E + # Contributing If you want to contribute or have bugfixes, drop me a note at or open an issue/PR here. diff --git a/boards.txt b/boards.txt index 9d6e2f382..95237965e 100644 --- a/boards.txt +++ b/boards.txt @@ -1,42 +1,827 @@ menu.BoardModel=Model -menu.led=Builtin LED -menu.ResetMethod=Reset Method -menu.dbg=Debug Port -menu.lvl=Debug Level - -############################################################## +menu.flash=Flash Size +menu.freq=CPU Speed +menu.dbgport=Debug Port +menu.dbglvl=Debug Level rpipico.name=Raspberry Pi Pico rpipico.vid.0=0x2e8a rpipico.pid.0=0x000a -rpipico.build.board=RPI_PICO +rpipico.build.usbpid=-DSERIALUSB_PID=0x000a +rpipico.build.board=RASPBERRY_PI_PICO rpipico.build.mcu=cortex-m0plus rpipico.build.variant=rpipico rpipico.upload.tool=uf2conv -rpipico.upload.maximum_data_size=81920 +rpipico.upload.maximum_size=2097152 +rpipico.upload.maximum_data_size=262144 rpipico.upload.wait_for_upload_port=true rpipico.upload.erase_cmd= -rpipico.serial.disableDTR=true -rpipico.serial.disableRTS=true +rpipico.serial.disableDTR=false +rpipico.serial.disableRTS=false +rpipico.build.f_cpu=125000000 rpipico.build.led= rpipico.build.core=rp2040 rpipico.build.mcu=rp2040 rpipico.build.ldscript=memmap_default.ld -rpipico.menu.dbg.Disabled.build.debug_port= -rpipico.menu.dbg.Serial=Serial -rpipico.menu.dbg.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial -rpipico.menu.dbg.Serial1=Serial1 -rpipico.menu.dbg.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1 -rpipico.menu.dbg.Serial2=Serial2 -rpipico.menu.dbg.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2 -rpipico.menu.lvl.None____=None -rpipico.menu.lvl.None____.build.debug_level= -rpipico.menu.lvl.Core=Core -rpipico.menu.lvl.Core.build.debug_level=-DDEBUG_RP2040_CORE -rpipico.menu.lvl.SPI=SPI -rpipico.menu.lvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI -rpipico.menu.lvl.Wire=Wire -rpipico.menu.lvl.Wire.build.debug_level=-DDEBUG_RP2040_WIRE -rpipico.menu.lvl.All=All -rpipico.menu.lvl.All.build.debug_level=-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE -rpipico.menu.lvl.NoAssert-NDEBUG=NoAssert-NDEBUG -rpipico.menu.lvl.NoAssert-NDEBUG.build.debug_level=-DNDEBUG +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 +rpipico.menu.flash.2097152_0.build.eeprom_start=270528512 +rpipico.menu.flash.2097152_0.build.fs_start=270528512 +rpipico.menu.flash.2097152_0.build.fs_end=270528512 +rpipico.menu.flash.2097152_65536=2MB (FS: 64KB) +rpipico.menu.flash.2097152_65536.upload.maximum_size=2027520 +rpipico.menu.flash.2097152_65536.build.flash_length=2027520 +rpipico.menu.flash.2097152_65536.build.eeprom_start=270528512 +rpipico.menu.flash.2097152_65536.build.fs_start=270462976 +rpipico.menu.flash.2097152_65536.build.fs_end=270528512 +rpipico.menu.flash.2097152_131072=2MB (FS: 128KB) +rpipico.menu.flash.2097152_131072.upload.maximum_size=1961984 +rpipico.menu.flash.2097152_131072.build.flash_length=1961984 +rpipico.menu.flash.2097152_131072.build.eeprom_start=270528512 +rpipico.menu.flash.2097152_131072.build.fs_start=270397440 +rpipico.menu.flash.2097152_131072.build.fs_end=270528512 +rpipico.menu.flash.2097152_262144=2MB (FS: 256KB) +rpipico.menu.flash.2097152_262144.upload.maximum_size=1830912 +rpipico.menu.flash.2097152_262144.build.flash_length=1830912 +rpipico.menu.flash.2097152_262144.build.eeprom_start=270528512 +rpipico.menu.flash.2097152_262144.build.fs_start=270266368 +rpipico.menu.flash.2097152_262144.build.fs_end=270528512 +rpipico.menu.flash.2097152_524288=2MB (FS: 512KB) +rpipico.menu.flash.2097152_524288.upload.maximum_size=1568768 +rpipico.menu.flash.2097152_524288.build.flash_length=1568768 +rpipico.menu.flash.2097152_524288.build.eeprom_start=270528512 +rpipico.menu.flash.2097152_524288.build.fs_start=270004224 +rpipico.menu.flash.2097152_524288.build.fs_end=270528512 +rpipico.menu.flash.2097152_1048576=2MB (FS: 1MB) +rpipico.menu.flash.2097152_1048576.upload.maximum_size=1044480 +rpipico.menu.flash.2097152_1048576.build.flash_length=1044480 +rpipico.menu.flash.2097152_1048576.build.eeprom_start=270528512 +rpipico.menu.flash.2097152_1048576.build.fs_start=269479936 +rpipico.menu.flash.2097152_1048576.build.fs_end=270528512 +rpipico.menu.freq.125=125 MHz +rpipico.menu.freq.125.build.f_cpu=125000000L +rpipico.menu.freq.50=50 MHz +rpipico.menu.freq.50.build.f_cpu=50000000L +rpipico.menu.freq.100=100 MHz +rpipico.menu.freq.100.build.f_cpu=100000000L +rpipico.menu.freq.133=133 MHz +rpipico.menu.freq.133.build.f_cpu=133000000L +rpipico.menu.freq.150=150 MHz (Overclock) +rpipico.menu.freq.150.build.f_cpu=150000000L +rpipico.menu.freq.175=175 MHz (Overclock) +rpipico.menu.freq.175.build.f_cpu=175000000L +rpipico.menu.freq.200=200 MHz (Overclock) +rpipico.menu.freq.200.build.f_cpu=200000000L +rpipico.menu.freq.225=225 MHz (Overclock) +rpipico.menu.freq.225.build.f_cpu=225000000L +rpipico.menu.freq.250=250 MHz (Overclock) +rpipico.menu.freq.250.build.f_cpu=250000000L +rpipico.menu.freq.275=275 MHz (Overclock) +rpipico.menu.freq.275.build.f_cpu=275000000L +rpipico.menu.freq.300=300 MHz (Overclock) +rpipico.menu.freq.300.build.f_cpu=300000000L +rpipico.menu.dbgport.Disabled=Disabled +rpipico.menu.dbgport.Disabled.build.debug_port= +rpipico.menu.dbgport.Serial=Serial +rpipico.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial +rpipico.menu.dbgport.Serial1=Serial1 +rpipico.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1 +rpipico.menu.dbgport.Serial2=Serial2 +rpipico.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2 +rpipico.menu.dbglvl.None=None +rpipico.menu.dbglvl.None.build.debug_level= +rpipico.menu.dbglvl.Core=Core +rpipico.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE +rpipico.menu.dbglvl.SPI=SPI +rpipico.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI +rpipico.menu.dbglvl.Wire=Wire +rpipico.menu.dbglvl.Wire.build.debug_level=DDEBUG_RP2040_WIRE +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 +rpipicopicoprobe.name=Raspberry Pi Pico (Picoprobe) +rpipicopicoprobe.vid.0=0x2e8a +rpipicopicoprobe.pid.0=0x000a +rpipicopicoprobe.build.usbpid=-DSERIALUSB_PID=0x000a +rpipicopicoprobe.build.board=RASPBERRY_PI_PICO +rpipicopicoprobe.build.mcu=cortex-m0plus +rpipicopicoprobe.build.variant=rpipico +rpipicopicoprobe.upload.tool=picoprobe +rpipicopicoprobe.upload.maximum_size=2097152 +rpipicopicoprobe.upload.maximum_data_size=262144 +rpipicopicoprobe.upload.wait_for_upload_port=true +rpipicopicoprobe.upload.erase_cmd= +rpipicopicoprobe.serial.disableDTR=false +rpipicopicoprobe.serial.disableRTS=false +rpipicopicoprobe.build.f_cpu=125000000 +rpipicopicoprobe.build.led= +rpipicopicoprobe.build.core=rp2040 +rpipicopicoprobe.build.mcu=rp2040 +rpipicopicoprobe.build.ldscript=memmap_default.ld +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 +rpipicopicoprobe.menu.flash.2097152_0.build.eeprom_start=270528512 +rpipicopicoprobe.menu.flash.2097152_0.build.fs_start=270528512 +rpipicopicoprobe.menu.flash.2097152_0.build.fs_end=270528512 +rpipicopicoprobe.menu.flash.2097152_65536=2MB (FS: 64KB) +rpipicopicoprobe.menu.flash.2097152_65536.upload.maximum_size=2027520 +rpipicopicoprobe.menu.flash.2097152_65536.build.flash_length=2027520 +rpipicopicoprobe.menu.flash.2097152_65536.build.eeprom_start=270528512 +rpipicopicoprobe.menu.flash.2097152_65536.build.fs_start=270462976 +rpipicopicoprobe.menu.flash.2097152_65536.build.fs_end=270528512 +rpipicopicoprobe.menu.flash.2097152_131072=2MB (FS: 128KB) +rpipicopicoprobe.menu.flash.2097152_131072.upload.maximum_size=1961984 +rpipicopicoprobe.menu.flash.2097152_131072.build.flash_length=1961984 +rpipicopicoprobe.menu.flash.2097152_131072.build.eeprom_start=270528512 +rpipicopicoprobe.menu.flash.2097152_131072.build.fs_start=270397440 +rpipicopicoprobe.menu.flash.2097152_131072.build.fs_end=270528512 +rpipicopicoprobe.menu.flash.2097152_262144=2MB (FS: 256KB) +rpipicopicoprobe.menu.flash.2097152_262144.upload.maximum_size=1830912 +rpipicopicoprobe.menu.flash.2097152_262144.build.flash_length=1830912 +rpipicopicoprobe.menu.flash.2097152_262144.build.eeprom_start=270528512 +rpipicopicoprobe.menu.flash.2097152_262144.build.fs_start=270266368 +rpipicopicoprobe.menu.flash.2097152_262144.build.fs_end=270528512 +rpipicopicoprobe.menu.flash.2097152_524288=2MB (FS: 512KB) +rpipicopicoprobe.menu.flash.2097152_524288.upload.maximum_size=1568768 +rpipicopicoprobe.menu.flash.2097152_524288.build.flash_length=1568768 +rpipicopicoprobe.menu.flash.2097152_524288.build.eeprom_start=270528512 +rpipicopicoprobe.menu.flash.2097152_524288.build.fs_start=270004224 +rpipicopicoprobe.menu.flash.2097152_524288.build.fs_end=270528512 +rpipicopicoprobe.menu.flash.2097152_1048576=2MB (FS: 1MB) +rpipicopicoprobe.menu.flash.2097152_1048576.upload.maximum_size=1044480 +rpipicopicoprobe.menu.flash.2097152_1048576.build.flash_length=1044480 +rpipicopicoprobe.menu.flash.2097152_1048576.build.eeprom_start=270528512 +rpipicopicoprobe.menu.flash.2097152_1048576.build.fs_start=269479936 +rpipicopicoprobe.menu.flash.2097152_1048576.build.fs_end=270528512 +rpipicopicoprobe.menu.freq.125=125 MHz +rpipicopicoprobe.menu.freq.125.build.f_cpu=125000000L +rpipicopicoprobe.menu.freq.50=50 MHz +rpipicopicoprobe.menu.freq.50.build.f_cpu=50000000L +rpipicopicoprobe.menu.freq.100=100 MHz +rpipicopicoprobe.menu.freq.100.build.f_cpu=100000000L +rpipicopicoprobe.menu.freq.133=133 MHz +rpipicopicoprobe.menu.freq.133.build.f_cpu=133000000L +rpipicopicoprobe.menu.freq.150=150 MHz (Overclock) +rpipicopicoprobe.menu.freq.150.build.f_cpu=150000000L +rpipicopicoprobe.menu.freq.175=175 MHz (Overclock) +rpipicopicoprobe.menu.freq.175.build.f_cpu=175000000L +rpipicopicoprobe.menu.freq.200=200 MHz (Overclock) +rpipicopicoprobe.menu.freq.200.build.f_cpu=200000000L +rpipicopicoprobe.menu.freq.225=225 MHz (Overclock) +rpipicopicoprobe.menu.freq.225.build.f_cpu=225000000L +rpipicopicoprobe.menu.freq.250=250 MHz (Overclock) +rpipicopicoprobe.menu.freq.250.build.f_cpu=250000000L +rpipicopicoprobe.menu.freq.275=275 MHz (Overclock) +rpipicopicoprobe.menu.freq.275.build.f_cpu=275000000L +rpipicopicoprobe.menu.freq.300=300 MHz (Overclock) +rpipicopicoprobe.menu.freq.300.build.f_cpu=300000000L +rpipicopicoprobe.menu.dbgport.Disabled=Disabled +rpipicopicoprobe.menu.dbgport.Disabled.build.debug_port= +rpipicopicoprobe.menu.dbgport.Serial=Serial +rpipicopicoprobe.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial +rpipicopicoprobe.menu.dbgport.Serial1=Serial1 +rpipicopicoprobe.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1 +rpipicopicoprobe.menu.dbgport.Serial2=Serial2 +rpipicopicoprobe.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2 +rpipicopicoprobe.menu.dbglvl.None=None +rpipicopicoprobe.menu.dbglvl.None.build.debug_level= +rpipicopicoprobe.menu.dbglvl.Core=Core +rpipicopicoprobe.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE +rpipicopicoprobe.menu.dbglvl.SPI=SPI +rpipicopicoprobe.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI +rpipicopicoprobe.menu.dbglvl.Wire=Wire +rpipicopicoprobe.menu.dbglvl.Wire.build.debug_level=DDEBUG_RP2040_WIRE +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 +adafruitfeather.name=Adafruit Feather RP2040 +adafruitfeather.vid.0=0x2e8a +adafruitfeather.pid.0=0x000b +adafruitfeather.build.usbpid=-DSERIALUSB_PID=0x000b +adafruitfeather.build.board=ADAFRUIT_FEATHER_RP2040 +adafruitfeather.build.mcu=cortex-m0plus +adafruitfeather.build.variant=adafruitfeather +adafruitfeather.upload.tool=uf2conv +adafruitfeather.upload.maximum_size=8388608 +adafruitfeather.upload.maximum_data_size=262144 +adafruitfeather.upload.wait_for_upload_port=true +adafruitfeather.upload.erase_cmd= +adafruitfeather.serial.disableDTR=false +adafruitfeather.serial.disableRTS=false +adafruitfeather.build.f_cpu=125000000 +adafruitfeather.build.led= +adafruitfeather.build.core=rp2040 +adafruitfeather.build.mcu=rp2040 +adafruitfeather.build.ldscript=memmap_default.ld +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 +adafruitfeather.menu.flash.8388608_0.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_0.build.fs_start=276819968 +adafruitfeather.menu.flash.8388608_0.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_65536=8MB (FS: 64KB) +adafruitfeather.menu.flash.8388608_65536.upload.maximum_size=8318976 +adafruitfeather.menu.flash.8388608_65536.build.flash_length=8318976 +adafruitfeather.menu.flash.8388608_65536.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_65536.build.fs_start=276754432 +adafruitfeather.menu.flash.8388608_65536.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_131072=8MB (FS: 128KB) +adafruitfeather.menu.flash.8388608_131072.upload.maximum_size=8253440 +adafruitfeather.menu.flash.8388608_131072.build.flash_length=8253440 +adafruitfeather.menu.flash.8388608_131072.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_131072.build.fs_start=276688896 +adafruitfeather.menu.flash.8388608_131072.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_262144=8MB (FS: 256KB) +adafruitfeather.menu.flash.8388608_262144.upload.maximum_size=8122368 +adafruitfeather.menu.flash.8388608_262144.build.flash_length=8122368 +adafruitfeather.menu.flash.8388608_262144.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_262144.build.fs_start=276557824 +adafruitfeather.menu.flash.8388608_262144.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_524288=8MB (FS: 512KB) +adafruitfeather.menu.flash.8388608_524288.upload.maximum_size=7860224 +adafruitfeather.menu.flash.8388608_524288.build.flash_length=7860224 +adafruitfeather.menu.flash.8388608_524288.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_524288.build.fs_start=276295680 +adafruitfeather.menu.flash.8388608_524288.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_1048576=8MB (FS: 1MB) +adafruitfeather.menu.flash.8388608_1048576.upload.maximum_size=7335936 +adafruitfeather.menu.flash.8388608_1048576.build.flash_length=7335936 +adafruitfeather.menu.flash.8388608_1048576.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_1048576.build.fs_start=275771392 +adafruitfeather.menu.flash.8388608_1048576.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_2097152=8MB (FS: 2MB) +adafruitfeather.menu.flash.8388608_2097152.upload.maximum_size=6287360 +adafruitfeather.menu.flash.8388608_2097152.build.flash_length=6287360 +adafruitfeather.menu.flash.8388608_2097152.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_2097152.build.fs_start=274722816 +adafruitfeather.menu.flash.8388608_2097152.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_3145728=8MB (FS: 3MB) +adafruitfeather.menu.flash.8388608_3145728.upload.maximum_size=5238784 +adafruitfeather.menu.flash.8388608_3145728.build.flash_length=5238784 +adafruitfeather.menu.flash.8388608_3145728.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_3145728.build.fs_start=273674240 +adafruitfeather.menu.flash.8388608_3145728.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_4194304=8MB (FS: 4MB) +adafruitfeather.menu.flash.8388608_4194304.upload.maximum_size=4190208 +adafruitfeather.menu.flash.8388608_4194304.build.flash_length=4190208 +adafruitfeather.menu.flash.8388608_4194304.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_4194304.build.fs_start=272625664 +adafruitfeather.menu.flash.8388608_4194304.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_5242880=8MB (FS: 5MB) +adafruitfeather.menu.flash.8388608_5242880.upload.maximum_size=3141632 +adafruitfeather.menu.flash.8388608_5242880.build.flash_length=3141632 +adafruitfeather.menu.flash.8388608_5242880.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_5242880.build.fs_start=271577088 +adafruitfeather.menu.flash.8388608_5242880.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_6291456=8MB (FS: 6MB) +adafruitfeather.menu.flash.8388608_6291456.upload.maximum_size=2093056 +adafruitfeather.menu.flash.8388608_6291456.build.flash_length=2093056 +adafruitfeather.menu.flash.8388608_6291456.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_6291456.build.fs_start=270528512 +adafruitfeather.menu.flash.8388608_6291456.build.fs_end=276819968 +adafruitfeather.menu.flash.8388608_7340032=8MB (FS: 7MB) +adafruitfeather.menu.flash.8388608_7340032.upload.maximum_size=1044480 +adafruitfeather.menu.flash.8388608_7340032.build.flash_length=1044480 +adafruitfeather.menu.flash.8388608_7340032.build.eeprom_start=276819968 +adafruitfeather.menu.flash.8388608_7340032.build.fs_start=269479936 +adafruitfeather.menu.flash.8388608_7340032.build.fs_end=276819968 +adafruitfeather.menu.freq.125=125 MHz +adafruitfeather.menu.freq.125.build.f_cpu=125000000L +adafruitfeather.menu.freq.50=50 MHz +adafruitfeather.menu.freq.50.build.f_cpu=50000000L +adafruitfeather.menu.freq.100=100 MHz +adafruitfeather.menu.freq.100.build.f_cpu=100000000L +adafruitfeather.menu.freq.133=133 MHz +adafruitfeather.menu.freq.133.build.f_cpu=133000000L +adafruitfeather.menu.freq.150=150 MHz (Overclock) +adafruitfeather.menu.freq.150.build.f_cpu=150000000L +adafruitfeather.menu.freq.175=175 MHz (Overclock) +adafruitfeather.menu.freq.175.build.f_cpu=175000000L +adafruitfeather.menu.freq.200=200 MHz (Overclock) +adafruitfeather.menu.freq.200.build.f_cpu=200000000L +adafruitfeather.menu.freq.225=225 MHz (Overclock) +adafruitfeather.menu.freq.225.build.f_cpu=225000000L +adafruitfeather.menu.freq.250=250 MHz (Overclock) +adafruitfeather.menu.freq.250.build.f_cpu=250000000L +adafruitfeather.menu.freq.275=275 MHz (Overclock) +adafruitfeather.menu.freq.275.build.f_cpu=275000000L +adafruitfeather.menu.freq.300=300 MHz (Overclock) +adafruitfeather.menu.freq.300.build.f_cpu=300000000L +adafruitfeather.menu.dbgport.Disabled=Disabled +adafruitfeather.menu.dbgport.Disabled.build.debug_port= +adafruitfeather.menu.dbgport.Serial=Serial +adafruitfeather.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial +adafruitfeather.menu.dbgport.Serial1=Serial1 +adafruitfeather.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1 +adafruitfeather.menu.dbgport.Serial2=Serial2 +adafruitfeather.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2 +adafruitfeather.menu.dbglvl.None=None +adafruitfeather.menu.dbglvl.None.build.debug_level= +adafruitfeather.menu.dbglvl.Core=Core +adafruitfeather.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE +adafruitfeather.menu.dbglvl.SPI=SPI +adafruitfeather.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI +adafruitfeather.menu.dbglvl.Wire=Wire +adafruitfeather.menu.dbglvl.Wire.build.debug_level=DDEBUG_RP2040_WIRE +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 +adafruitfeatherpicoprobe.name=Adafruit Feather RP2040 (Picoprobe) +adafruitfeatherpicoprobe.vid.0=0x2e8a +adafruitfeatherpicoprobe.pid.0=0x000b +adafruitfeatherpicoprobe.build.usbpid=-DSERIALUSB_PID=0x000b +adafruitfeatherpicoprobe.build.board=ADAFRUIT_FEATHER_RP2040 +adafruitfeatherpicoprobe.build.mcu=cortex-m0plus +adafruitfeatherpicoprobe.build.variant=adafruitfeather +adafruitfeatherpicoprobe.upload.tool=picoprobe +adafruitfeatherpicoprobe.upload.maximum_size=8388608 +adafruitfeatherpicoprobe.upload.maximum_data_size=262144 +adafruitfeatherpicoprobe.upload.wait_for_upload_port=true +adafruitfeatherpicoprobe.upload.erase_cmd= +adafruitfeatherpicoprobe.serial.disableDTR=false +adafruitfeatherpicoprobe.serial.disableRTS=false +adafruitfeatherpicoprobe.build.f_cpu=125000000 +adafruitfeatherpicoprobe.build.led= +adafruitfeatherpicoprobe.build.core=rp2040 +adafruitfeatherpicoprobe.build.mcu=rp2040 +adafruitfeatherpicoprobe.build.ldscript=memmap_default.ld +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 +adafruitfeatherpicoprobe.menu.flash.8388608_0.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_0.build.fs_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_0.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_65536=8MB (FS: 64KB) +adafruitfeatherpicoprobe.menu.flash.8388608_65536.upload.maximum_size=8318976 +adafruitfeatherpicoprobe.menu.flash.8388608_65536.build.flash_length=8318976 +adafruitfeatherpicoprobe.menu.flash.8388608_65536.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_65536.build.fs_start=276754432 +adafruitfeatherpicoprobe.menu.flash.8388608_65536.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_131072=8MB (FS: 128KB) +adafruitfeatherpicoprobe.menu.flash.8388608_131072.upload.maximum_size=8253440 +adafruitfeatherpicoprobe.menu.flash.8388608_131072.build.flash_length=8253440 +adafruitfeatherpicoprobe.menu.flash.8388608_131072.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_131072.build.fs_start=276688896 +adafruitfeatherpicoprobe.menu.flash.8388608_131072.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_262144=8MB (FS: 256KB) +adafruitfeatherpicoprobe.menu.flash.8388608_262144.upload.maximum_size=8122368 +adafruitfeatherpicoprobe.menu.flash.8388608_262144.build.flash_length=8122368 +adafruitfeatherpicoprobe.menu.flash.8388608_262144.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_262144.build.fs_start=276557824 +adafruitfeatherpicoprobe.menu.flash.8388608_262144.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_524288=8MB (FS: 512KB) +adafruitfeatherpicoprobe.menu.flash.8388608_524288.upload.maximum_size=7860224 +adafruitfeatherpicoprobe.menu.flash.8388608_524288.build.flash_length=7860224 +adafruitfeatherpicoprobe.menu.flash.8388608_524288.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_524288.build.fs_start=276295680 +adafruitfeatherpicoprobe.menu.flash.8388608_524288.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_1048576=8MB (FS: 1MB) +adafruitfeatherpicoprobe.menu.flash.8388608_1048576.upload.maximum_size=7335936 +adafruitfeatherpicoprobe.menu.flash.8388608_1048576.build.flash_length=7335936 +adafruitfeatherpicoprobe.menu.flash.8388608_1048576.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_1048576.build.fs_start=275771392 +adafruitfeatherpicoprobe.menu.flash.8388608_1048576.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_2097152=8MB (FS: 2MB) +adafruitfeatherpicoprobe.menu.flash.8388608_2097152.upload.maximum_size=6287360 +adafruitfeatherpicoprobe.menu.flash.8388608_2097152.build.flash_length=6287360 +adafruitfeatherpicoprobe.menu.flash.8388608_2097152.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_2097152.build.fs_start=274722816 +adafruitfeatherpicoprobe.menu.flash.8388608_2097152.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_3145728=8MB (FS: 3MB) +adafruitfeatherpicoprobe.menu.flash.8388608_3145728.upload.maximum_size=5238784 +adafruitfeatherpicoprobe.menu.flash.8388608_3145728.build.flash_length=5238784 +adafruitfeatherpicoprobe.menu.flash.8388608_3145728.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_3145728.build.fs_start=273674240 +adafruitfeatherpicoprobe.menu.flash.8388608_3145728.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_4194304=8MB (FS: 4MB) +adafruitfeatherpicoprobe.menu.flash.8388608_4194304.upload.maximum_size=4190208 +adafruitfeatherpicoprobe.menu.flash.8388608_4194304.build.flash_length=4190208 +adafruitfeatherpicoprobe.menu.flash.8388608_4194304.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_4194304.build.fs_start=272625664 +adafruitfeatherpicoprobe.menu.flash.8388608_4194304.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_5242880=8MB (FS: 5MB) +adafruitfeatherpicoprobe.menu.flash.8388608_5242880.upload.maximum_size=3141632 +adafruitfeatherpicoprobe.menu.flash.8388608_5242880.build.flash_length=3141632 +adafruitfeatherpicoprobe.menu.flash.8388608_5242880.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_5242880.build.fs_start=271577088 +adafruitfeatherpicoprobe.menu.flash.8388608_5242880.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_6291456=8MB (FS: 6MB) +adafruitfeatherpicoprobe.menu.flash.8388608_6291456.upload.maximum_size=2093056 +adafruitfeatherpicoprobe.menu.flash.8388608_6291456.build.flash_length=2093056 +adafruitfeatherpicoprobe.menu.flash.8388608_6291456.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_6291456.build.fs_start=270528512 +adafruitfeatherpicoprobe.menu.flash.8388608_6291456.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_7340032=8MB (FS: 7MB) +adafruitfeatherpicoprobe.menu.flash.8388608_7340032.upload.maximum_size=1044480 +adafruitfeatherpicoprobe.menu.flash.8388608_7340032.build.flash_length=1044480 +adafruitfeatherpicoprobe.menu.flash.8388608_7340032.build.eeprom_start=276819968 +adafruitfeatherpicoprobe.menu.flash.8388608_7340032.build.fs_start=269479936 +adafruitfeatherpicoprobe.menu.flash.8388608_7340032.build.fs_end=276819968 +adafruitfeatherpicoprobe.menu.freq.125=125 MHz +adafruitfeatherpicoprobe.menu.freq.125.build.f_cpu=125000000L +adafruitfeatherpicoprobe.menu.freq.50=50 MHz +adafruitfeatherpicoprobe.menu.freq.50.build.f_cpu=50000000L +adafruitfeatherpicoprobe.menu.freq.100=100 MHz +adafruitfeatherpicoprobe.menu.freq.100.build.f_cpu=100000000L +adafruitfeatherpicoprobe.menu.freq.133=133 MHz +adafruitfeatherpicoprobe.menu.freq.133.build.f_cpu=133000000L +adafruitfeatherpicoprobe.menu.freq.150=150 MHz (Overclock) +adafruitfeatherpicoprobe.menu.freq.150.build.f_cpu=150000000L +adafruitfeatherpicoprobe.menu.freq.175=175 MHz (Overclock) +adafruitfeatherpicoprobe.menu.freq.175.build.f_cpu=175000000L +adafruitfeatherpicoprobe.menu.freq.200=200 MHz (Overclock) +adafruitfeatherpicoprobe.menu.freq.200.build.f_cpu=200000000L +adafruitfeatherpicoprobe.menu.freq.225=225 MHz (Overclock) +adafruitfeatherpicoprobe.menu.freq.225.build.f_cpu=225000000L +adafruitfeatherpicoprobe.menu.freq.250=250 MHz (Overclock) +adafruitfeatherpicoprobe.menu.freq.250.build.f_cpu=250000000L +adafruitfeatherpicoprobe.menu.freq.275=275 MHz (Overclock) +adafruitfeatherpicoprobe.menu.freq.275.build.f_cpu=275000000L +adafruitfeatherpicoprobe.menu.freq.300=300 MHz (Overclock) +adafruitfeatherpicoprobe.menu.freq.300.build.f_cpu=300000000L +adafruitfeatherpicoprobe.menu.dbgport.Disabled=Disabled +adafruitfeatherpicoprobe.menu.dbgport.Disabled.build.debug_port= +adafruitfeatherpicoprobe.menu.dbgport.Serial=Serial +adafruitfeatherpicoprobe.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial +adafruitfeatherpicoprobe.menu.dbgport.Serial1=Serial1 +adafruitfeatherpicoprobe.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1 +adafruitfeatherpicoprobe.menu.dbgport.Serial2=Serial2 +adafruitfeatherpicoprobe.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2 +adafruitfeatherpicoprobe.menu.dbglvl.None=None +adafruitfeatherpicoprobe.menu.dbglvl.None.build.debug_level= +adafruitfeatherpicoprobe.menu.dbglvl.Core=Core +adafruitfeatherpicoprobe.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE +adafruitfeatherpicoprobe.menu.dbglvl.SPI=SPI +adafruitfeatherpicoprobe.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI +adafruitfeatherpicoprobe.menu.dbglvl.Wire=Wire +adafruitfeatherpicoprobe.menu.dbglvl.Wire.build.debug_level=DDEBUG_RP2040_WIRE +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 +generic.name=Generic RP2040 +generic.vid.0=0x2e8a +generic.pid.0=0xf00a +generic.build.usbpid=-DSERIALUSB_PID=0xf00a +generic.build.board=GENERIC_RP2040 +generic.build.mcu=cortex-m0plus +generic.build.variant=generic +generic.upload.tool=uf2conv +generic.upload.maximum_size=16777216 +generic.upload.maximum_data_size=262144 +generic.upload.wait_for_upload_port=true +generic.upload.erase_cmd= +generic.serial.disableDTR=false +generic.serial.disableRTS=false +generic.build.f_cpu=125000000 +generic.build.led= +generic.build.core=rp2040 +generic.build.mcu=rp2040 +generic.build.ldscript=memmap_default.ld +generic.menu.flash.16777216_0=16MB (no FS) +generic.menu.flash.16777216_0.upload.maximum_size=16773120 +generic.menu.flash.16777216_0.build.flash_length=16773120 +generic.menu.flash.16777216_0.build.eeprom_start=285208576 +generic.menu.flash.16777216_0.build.fs_start=285208576 +generic.menu.flash.16777216_0.build.fs_end=285208576 +generic.menu.flash.16777216_65536=16MB (FS: 64KB) +generic.menu.flash.16777216_65536.upload.maximum_size=16707584 +generic.menu.flash.16777216_65536.build.flash_length=16707584 +generic.menu.flash.16777216_65536.build.eeprom_start=285208576 +generic.menu.flash.16777216_65536.build.fs_start=285143040 +generic.menu.flash.16777216_65536.build.fs_end=285208576 +generic.menu.flash.16777216_131072=16MB (FS: 128KB) +generic.menu.flash.16777216_131072.upload.maximum_size=16642048 +generic.menu.flash.16777216_131072.build.flash_length=16642048 +generic.menu.flash.16777216_131072.build.eeprom_start=285208576 +generic.menu.flash.16777216_131072.build.fs_start=285077504 +generic.menu.flash.16777216_131072.build.fs_end=285208576 +generic.menu.flash.16777216_262144=16MB (FS: 256KB) +generic.menu.flash.16777216_262144.upload.maximum_size=16510976 +generic.menu.flash.16777216_262144.build.flash_length=16510976 +generic.menu.flash.16777216_262144.build.eeprom_start=285208576 +generic.menu.flash.16777216_262144.build.fs_start=284946432 +generic.menu.flash.16777216_262144.build.fs_end=285208576 +generic.menu.flash.16777216_524288=16MB (FS: 512KB) +generic.menu.flash.16777216_524288.upload.maximum_size=16248832 +generic.menu.flash.16777216_524288.build.flash_length=16248832 +generic.menu.flash.16777216_524288.build.eeprom_start=285208576 +generic.menu.flash.16777216_524288.build.fs_start=284684288 +generic.menu.flash.16777216_524288.build.fs_end=285208576 +generic.menu.flash.16777216_1048576=16MB (FS: 1MB) +generic.menu.flash.16777216_1048576.upload.maximum_size=15724544 +generic.menu.flash.16777216_1048576.build.flash_length=15724544 +generic.menu.flash.16777216_1048576.build.eeprom_start=285208576 +generic.menu.flash.16777216_1048576.build.fs_start=284160000 +generic.menu.flash.16777216_1048576.build.fs_end=285208576 +generic.menu.flash.16777216_2097152=16MB (FS: 2MB) +generic.menu.flash.16777216_2097152.upload.maximum_size=14675968 +generic.menu.flash.16777216_2097152.build.flash_length=14675968 +generic.menu.flash.16777216_2097152.build.eeprom_start=285208576 +generic.menu.flash.16777216_2097152.build.fs_start=283111424 +generic.menu.flash.16777216_2097152.build.fs_end=285208576 +generic.menu.flash.16777216_3145728=16MB (FS: 3MB) +generic.menu.flash.16777216_3145728.upload.maximum_size=13627392 +generic.menu.flash.16777216_3145728.build.flash_length=13627392 +generic.menu.flash.16777216_3145728.build.eeprom_start=285208576 +generic.menu.flash.16777216_3145728.build.fs_start=282062848 +generic.menu.flash.16777216_3145728.build.fs_end=285208576 +generic.menu.flash.16777216_4194304=16MB (FS: 4MB) +generic.menu.flash.16777216_4194304.upload.maximum_size=12578816 +generic.menu.flash.16777216_4194304.build.flash_length=12578816 +generic.menu.flash.16777216_4194304.build.eeprom_start=285208576 +generic.menu.flash.16777216_4194304.build.fs_start=281014272 +generic.menu.flash.16777216_4194304.build.fs_end=285208576 +generic.menu.flash.16777216_5242880=16MB (FS: 5MB) +generic.menu.flash.16777216_5242880.upload.maximum_size=11530240 +generic.menu.flash.16777216_5242880.build.flash_length=11530240 +generic.menu.flash.16777216_5242880.build.eeprom_start=285208576 +generic.menu.flash.16777216_5242880.build.fs_start=279965696 +generic.menu.flash.16777216_5242880.build.fs_end=285208576 +generic.menu.flash.16777216_6291456=16MB (FS: 6MB) +generic.menu.flash.16777216_6291456.upload.maximum_size=10481664 +generic.menu.flash.16777216_6291456.build.flash_length=10481664 +generic.menu.flash.16777216_6291456.build.eeprom_start=285208576 +generic.menu.flash.16777216_6291456.build.fs_start=278917120 +generic.menu.flash.16777216_6291456.build.fs_end=285208576 +generic.menu.flash.16777216_7340032=16MB (FS: 7MB) +generic.menu.flash.16777216_7340032.upload.maximum_size=9433088 +generic.menu.flash.16777216_7340032.build.flash_length=9433088 +generic.menu.flash.16777216_7340032.build.eeprom_start=285208576 +generic.menu.flash.16777216_7340032.build.fs_start=277868544 +generic.menu.flash.16777216_7340032.build.fs_end=285208576 +generic.menu.flash.16777216_8388608=16MB (FS: 8MB) +generic.menu.flash.16777216_8388608.upload.maximum_size=8384512 +generic.menu.flash.16777216_8388608.build.flash_length=8384512 +generic.menu.flash.16777216_8388608.build.eeprom_start=285208576 +generic.menu.flash.16777216_8388608.build.fs_start=276819968 +generic.menu.flash.16777216_8388608.build.fs_end=285208576 +generic.menu.flash.16777216_9437184=16MB (FS: 9MB) +generic.menu.flash.16777216_9437184.upload.maximum_size=7335936 +generic.menu.flash.16777216_9437184.build.flash_length=7335936 +generic.menu.flash.16777216_9437184.build.eeprom_start=285208576 +generic.menu.flash.16777216_9437184.build.fs_start=275771392 +generic.menu.flash.16777216_9437184.build.fs_end=285208576 +generic.menu.flash.16777216_10485760=16MB (FS: 10MB) +generic.menu.flash.16777216_10485760.upload.maximum_size=6287360 +generic.menu.flash.16777216_10485760.build.flash_length=6287360 +generic.menu.flash.16777216_10485760.build.eeprom_start=285208576 +generic.menu.flash.16777216_10485760.build.fs_start=274722816 +generic.menu.flash.16777216_10485760.build.fs_end=285208576 +generic.menu.flash.16777216_11534336=16MB (FS: 11MB) +generic.menu.flash.16777216_11534336.upload.maximum_size=5238784 +generic.menu.flash.16777216_11534336.build.flash_length=5238784 +generic.menu.flash.16777216_11534336.build.eeprom_start=285208576 +generic.menu.flash.16777216_11534336.build.fs_start=273674240 +generic.menu.flash.16777216_11534336.build.fs_end=285208576 +generic.menu.flash.16777216_12582912=16MB (FS: 12MB) +generic.menu.flash.16777216_12582912.upload.maximum_size=4190208 +generic.menu.flash.16777216_12582912.build.flash_length=4190208 +generic.menu.flash.16777216_12582912.build.eeprom_start=285208576 +generic.menu.flash.16777216_12582912.build.fs_start=272625664 +generic.menu.flash.16777216_12582912.build.fs_end=285208576 +generic.menu.flash.16777216_13631488=16MB (FS: 13MB) +generic.menu.flash.16777216_13631488.upload.maximum_size=3141632 +generic.menu.flash.16777216_13631488.build.flash_length=3141632 +generic.menu.flash.16777216_13631488.build.eeprom_start=285208576 +generic.menu.flash.16777216_13631488.build.fs_start=271577088 +generic.menu.flash.16777216_13631488.build.fs_end=285208576 +generic.menu.flash.16777216_14680064=16MB (FS: 14MB) +generic.menu.flash.16777216_14680064.upload.maximum_size=2093056 +generic.menu.flash.16777216_14680064.build.flash_length=2093056 +generic.menu.flash.16777216_14680064.build.eeprom_start=285208576 +generic.menu.flash.16777216_14680064.build.fs_start=270528512 +generic.menu.flash.16777216_14680064.build.fs_end=285208576 +generic.menu.flash.16777216_15728640=16MB (FS: 15MB) +generic.menu.flash.16777216_15728640.upload.maximum_size=1044480 +generic.menu.flash.16777216_15728640.build.flash_length=1044480 +generic.menu.flash.16777216_15728640.build.eeprom_start=285208576 +generic.menu.flash.16777216_15728640.build.fs_start=269479936 +generic.menu.flash.16777216_15728640.build.fs_end=285208576 +generic.menu.freq.125=125 MHz +generic.menu.freq.125.build.f_cpu=125000000L +generic.menu.freq.50=50 MHz +generic.menu.freq.50.build.f_cpu=50000000L +generic.menu.freq.100=100 MHz +generic.menu.freq.100.build.f_cpu=100000000L +generic.menu.freq.133=133 MHz +generic.menu.freq.133.build.f_cpu=133000000L +generic.menu.freq.150=150 MHz (Overclock) +generic.menu.freq.150.build.f_cpu=150000000L +generic.menu.freq.175=175 MHz (Overclock) +generic.menu.freq.175.build.f_cpu=175000000L +generic.menu.freq.200=200 MHz (Overclock) +generic.menu.freq.200.build.f_cpu=200000000L +generic.menu.freq.225=225 MHz (Overclock) +generic.menu.freq.225.build.f_cpu=225000000L +generic.menu.freq.250=250 MHz (Overclock) +generic.menu.freq.250.build.f_cpu=250000000L +generic.menu.freq.275=275 MHz (Overclock) +generic.menu.freq.275.build.f_cpu=275000000L +generic.menu.freq.300=300 MHz (Overclock) +generic.menu.freq.300.build.f_cpu=300000000L +generic.menu.dbgport.Disabled=Disabled +generic.menu.dbgport.Disabled.build.debug_port= +generic.menu.dbgport.Serial=Serial +generic.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial +generic.menu.dbgport.Serial1=Serial1 +generic.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1 +generic.menu.dbgport.Serial2=Serial2 +generic.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2 +generic.menu.dbglvl.None=None +generic.menu.dbglvl.None.build.debug_level= +generic.menu.dbglvl.Core=Core +generic.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE +generic.menu.dbglvl.SPI=SPI +generic.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI +generic.menu.dbglvl.Wire=Wire +generic.menu.dbglvl.Wire.build.debug_level=DDEBUG_RP2040_WIRE +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 +genericpicoprobe.name=Generic RP2040 (Picoprobe) +genericpicoprobe.vid.0=0x2e8a +genericpicoprobe.pid.0=0xf00a +genericpicoprobe.build.usbpid=-DSERIALUSB_PID=0xf00a +genericpicoprobe.build.board=GENERIC_RP2040 +genericpicoprobe.build.mcu=cortex-m0plus +genericpicoprobe.build.variant=generic +genericpicoprobe.upload.tool=picoprobe +genericpicoprobe.upload.maximum_size=16777216 +genericpicoprobe.upload.maximum_data_size=262144 +genericpicoprobe.upload.wait_for_upload_port=true +genericpicoprobe.upload.erase_cmd= +genericpicoprobe.serial.disableDTR=false +genericpicoprobe.serial.disableRTS=false +genericpicoprobe.build.f_cpu=125000000 +genericpicoprobe.build.led= +genericpicoprobe.build.core=rp2040 +genericpicoprobe.build.mcu=rp2040 +genericpicoprobe.build.ldscript=memmap_default.ld +genericpicoprobe.menu.flash.16777216_0=16MB (no FS) +genericpicoprobe.menu.flash.16777216_0.upload.maximum_size=16773120 +genericpicoprobe.menu.flash.16777216_0.build.flash_length=16773120 +genericpicoprobe.menu.flash.16777216_0.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_0.build.fs_start=285208576 +genericpicoprobe.menu.flash.16777216_0.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_65536=16MB (FS: 64KB) +genericpicoprobe.menu.flash.16777216_65536.upload.maximum_size=16707584 +genericpicoprobe.menu.flash.16777216_65536.build.flash_length=16707584 +genericpicoprobe.menu.flash.16777216_65536.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_65536.build.fs_start=285143040 +genericpicoprobe.menu.flash.16777216_65536.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_131072=16MB (FS: 128KB) +genericpicoprobe.menu.flash.16777216_131072.upload.maximum_size=16642048 +genericpicoprobe.menu.flash.16777216_131072.build.flash_length=16642048 +genericpicoprobe.menu.flash.16777216_131072.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_131072.build.fs_start=285077504 +genericpicoprobe.menu.flash.16777216_131072.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_262144=16MB (FS: 256KB) +genericpicoprobe.menu.flash.16777216_262144.upload.maximum_size=16510976 +genericpicoprobe.menu.flash.16777216_262144.build.flash_length=16510976 +genericpicoprobe.menu.flash.16777216_262144.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_262144.build.fs_start=284946432 +genericpicoprobe.menu.flash.16777216_262144.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_524288=16MB (FS: 512KB) +genericpicoprobe.menu.flash.16777216_524288.upload.maximum_size=16248832 +genericpicoprobe.menu.flash.16777216_524288.build.flash_length=16248832 +genericpicoprobe.menu.flash.16777216_524288.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_524288.build.fs_start=284684288 +genericpicoprobe.menu.flash.16777216_524288.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_1048576=16MB (FS: 1MB) +genericpicoprobe.menu.flash.16777216_1048576.upload.maximum_size=15724544 +genericpicoprobe.menu.flash.16777216_1048576.build.flash_length=15724544 +genericpicoprobe.menu.flash.16777216_1048576.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_1048576.build.fs_start=284160000 +genericpicoprobe.menu.flash.16777216_1048576.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_2097152=16MB (FS: 2MB) +genericpicoprobe.menu.flash.16777216_2097152.upload.maximum_size=14675968 +genericpicoprobe.menu.flash.16777216_2097152.build.flash_length=14675968 +genericpicoprobe.menu.flash.16777216_2097152.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_2097152.build.fs_start=283111424 +genericpicoprobe.menu.flash.16777216_2097152.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_3145728=16MB (FS: 3MB) +genericpicoprobe.menu.flash.16777216_3145728.upload.maximum_size=13627392 +genericpicoprobe.menu.flash.16777216_3145728.build.flash_length=13627392 +genericpicoprobe.menu.flash.16777216_3145728.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_3145728.build.fs_start=282062848 +genericpicoprobe.menu.flash.16777216_3145728.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_4194304=16MB (FS: 4MB) +genericpicoprobe.menu.flash.16777216_4194304.upload.maximum_size=12578816 +genericpicoprobe.menu.flash.16777216_4194304.build.flash_length=12578816 +genericpicoprobe.menu.flash.16777216_4194304.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_4194304.build.fs_start=281014272 +genericpicoprobe.menu.flash.16777216_4194304.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_5242880=16MB (FS: 5MB) +genericpicoprobe.menu.flash.16777216_5242880.upload.maximum_size=11530240 +genericpicoprobe.menu.flash.16777216_5242880.build.flash_length=11530240 +genericpicoprobe.menu.flash.16777216_5242880.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_5242880.build.fs_start=279965696 +genericpicoprobe.menu.flash.16777216_5242880.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_6291456=16MB (FS: 6MB) +genericpicoprobe.menu.flash.16777216_6291456.upload.maximum_size=10481664 +genericpicoprobe.menu.flash.16777216_6291456.build.flash_length=10481664 +genericpicoprobe.menu.flash.16777216_6291456.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_6291456.build.fs_start=278917120 +genericpicoprobe.menu.flash.16777216_6291456.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_7340032=16MB (FS: 7MB) +genericpicoprobe.menu.flash.16777216_7340032.upload.maximum_size=9433088 +genericpicoprobe.menu.flash.16777216_7340032.build.flash_length=9433088 +genericpicoprobe.menu.flash.16777216_7340032.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_7340032.build.fs_start=277868544 +genericpicoprobe.menu.flash.16777216_7340032.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_8388608=16MB (FS: 8MB) +genericpicoprobe.menu.flash.16777216_8388608.upload.maximum_size=8384512 +genericpicoprobe.menu.flash.16777216_8388608.build.flash_length=8384512 +genericpicoprobe.menu.flash.16777216_8388608.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_8388608.build.fs_start=276819968 +genericpicoprobe.menu.flash.16777216_8388608.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_9437184=16MB (FS: 9MB) +genericpicoprobe.menu.flash.16777216_9437184.upload.maximum_size=7335936 +genericpicoprobe.menu.flash.16777216_9437184.build.flash_length=7335936 +genericpicoprobe.menu.flash.16777216_9437184.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_9437184.build.fs_start=275771392 +genericpicoprobe.menu.flash.16777216_9437184.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_10485760=16MB (FS: 10MB) +genericpicoprobe.menu.flash.16777216_10485760.upload.maximum_size=6287360 +genericpicoprobe.menu.flash.16777216_10485760.build.flash_length=6287360 +genericpicoprobe.menu.flash.16777216_10485760.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_10485760.build.fs_start=274722816 +genericpicoprobe.menu.flash.16777216_10485760.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_11534336=16MB (FS: 11MB) +genericpicoprobe.menu.flash.16777216_11534336.upload.maximum_size=5238784 +genericpicoprobe.menu.flash.16777216_11534336.build.flash_length=5238784 +genericpicoprobe.menu.flash.16777216_11534336.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_11534336.build.fs_start=273674240 +genericpicoprobe.menu.flash.16777216_11534336.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_12582912=16MB (FS: 12MB) +genericpicoprobe.menu.flash.16777216_12582912.upload.maximum_size=4190208 +genericpicoprobe.menu.flash.16777216_12582912.build.flash_length=4190208 +genericpicoprobe.menu.flash.16777216_12582912.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_12582912.build.fs_start=272625664 +genericpicoprobe.menu.flash.16777216_12582912.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_13631488=16MB (FS: 13MB) +genericpicoprobe.menu.flash.16777216_13631488.upload.maximum_size=3141632 +genericpicoprobe.menu.flash.16777216_13631488.build.flash_length=3141632 +genericpicoprobe.menu.flash.16777216_13631488.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_13631488.build.fs_start=271577088 +genericpicoprobe.menu.flash.16777216_13631488.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_14680064=16MB (FS: 14MB) +genericpicoprobe.menu.flash.16777216_14680064.upload.maximum_size=2093056 +genericpicoprobe.menu.flash.16777216_14680064.build.flash_length=2093056 +genericpicoprobe.menu.flash.16777216_14680064.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_14680064.build.fs_start=270528512 +genericpicoprobe.menu.flash.16777216_14680064.build.fs_end=285208576 +genericpicoprobe.menu.flash.16777216_15728640=16MB (FS: 15MB) +genericpicoprobe.menu.flash.16777216_15728640.upload.maximum_size=1044480 +genericpicoprobe.menu.flash.16777216_15728640.build.flash_length=1044480 +genericpicoprobe.menu.flash.16777216_15728640.build.eeprom_start=285208576 +genericpicoprobe.menu.flash.16777216_15728640.build.fs_start=269479936 +genericpicoprobe.menu.flash.16777216_15728640.build.fs_end=285208576 +genericpicoprobe.menu.freq.125=125 MHz +genericpicoprobe.menu.freq.125.build.f_cpu=125000000L +genericpicoprobe.menu.freq.50=50 MHz +genericpicoprobe.menu.freq.50.build.f_cpu=50000000L +genericpicoprobe.menu.freq.100=100 MHz +genericpicoprobe.menu.freq.100.build.f_cpu=100000000L +genericpicoprobe.menu.freq.133=133 MHz +genericpicoprobe.menu.freq.133.build.f_cpu=133000000L +genericpicoprobe.menu.freq.150=150 MHz (Overclock) +genericpicoprobe.menu.freq.150.build.f_cpu=150000000L +genericpicoprobe.menu.freq.175=175 MHz (Overclock) +genericpicoprobe.menu.freq.175.build.f_cpu=175000000L +genericpicoprobe.menu.freq.200=200 MHz (Overclock) +genericpicoprobe.menu.freq.200.build.f_cpu=200000000L +genericpicoprobe.menu.freq.225=225 MHz (Overclock) +genericpicoprobe.menu.freq.225.build.f_cpu=225000000L +genericpicoprobe.menu.freq.250=250 MHz (Overclock) +genericpicoprobe.menu.freq.250.build.f_cpu=250000000L +genericpicoprobe.menu.freq.275=275 MHz (Overclock) +genericpicoprobe.menu.freq.275.build.f_cpu=275000000L +genericpicoprobe.menu.freq.300=300 MHz (Overclock) +genericpicoprobe.menu.freq.300.build.f_cpu=300000000L +genericpicoprobe.menu.dbgport.Disabled=Disabled +genericpicoprobe.menu.dbgport.Disabled.build.debug_port= +genericpicoprobe.menu.dbgport.Serial=Serial +genericpicoprobe.menu.dbgport.Serial.build.debug_port=-DDEBUG_RP2040_PORT=Serial +genericpicoprobe.menu.dbgport.Serial1=Serial1 +genericpicoprobe.menu.dbgport.Serial1.build.debug_port=-DDEBUG_RP2040_PORT=Serial1 +genericpicoprobe.menu.dbgport.Serial2=Serial2 +genericpicoprobe.menu.dbgport.Serial2.build.debug_port=-DDEBUG_RP2040_PORT=Serial2 +genericpicoprobe.menu.dbglvl.None=None +genericpicoprobe.menu.dbglvl.None.build.debug_level= +genericpicoprobe.menu.dbglvl.Core=Core +genericpicoprobe.menu.dbglvl.Core.build.debug_level=-DDEBUG_RP2040_CORE +genericpicoprobe.menu.dbglvl.SPI=SPI +genericpicoprobe.menu.dbglvl.SPI.build.debug_level=-DDEBUG_RP2040_SPI +genericpicoprobe.menu.dbglvl.Wire=Wire +genericpicoprobe.menu.dbglvl.Wire.build.debug_level=DDEBUG_RP2040_WIRE +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 diff --git a/cores/rp2040/Arduino.h b/cores/rp2040/Arduino.h index 9b39020d4..7240fa31d 100644 --- a/cores/rp2040/Arduino.h +++ b/cores/rp2040/Arduino.h @@ -28,6 +28,7 @@ #include "api/ArduinoAPI.h" #include +#define digitalPinToInterrupt(P) (P) #include "debug_internal.h" @@ -35,6 +36,13 @@ extern "C"{ #endif // __cplusplus +void interrupts(); +void noInterrupts(); +void attachInterrupt(pin_size_t pin, voidFuncPtr callback, PinStatus mode); +void detachInterrupt(pin_size_t pin); + + + void pinMode(pin_size_t pinNumber, PinMode pinMode); // SIO (GPIO) @@ -51,7 +59,6 @@ void delay(unsigned long); void delayMicroseconds(unsigned int us); unsigned long millis(); - #ifdef __cplusplus } // extern "C" #endif @@ -60,6 +67,14 @@ unsigned long millis(); #include "SerialUSB.h" #include "SerialUART.h" #include "RP2040.h" +#include "Bootsel.h" + +// Template which will evaluate at *compile time* to a single 32b number +// with the specified bits set. +template +constexpr uint32_t __bitset(const int (&a)[N], size_t i = 0U) { + return i < N ? (1L << a[i]) | __bitset(a, i+1) : 0; +} #endif diff --git a/cores/rp2040/Bootsel.cpp b/cores/rp2040/Bootsel.cpp new file mode 100644 index 000000000..63a2717ae --- /dev/null +++ b/cores/rp2040/Bootsel.cpp @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. + * + * SPDX-License-Identifier: BSD-3-Clause + */ +#include +#include "pico/stdlib.h" +#include "hardware/gpio.h" +#include "hardware/sync.h" +#include "hardware/structs/ioqspi.h" +#include "hardware/structs/sio.h" + +// This example blinks the Pico LED when the BOOTSEL button is pressed. +// +// Picoboard has a button attached to the flash CS pin, which the bootrom +// checks, and jumps straight to the USB bootcode if the button is pressed +// (pulling flash CS low). We can check this pin in by jumping to some code in +// SRAM (so that the XIP interface is not required), floating the flash CS +// pin, and observing whether it is pulled low. +// +// This doesn't work if others are trying to access flash at the same time, +// e.g. XIP streamer, or the other core. + +static bool __no_inline_not_in_flash_func(get_bootsel_button)() { + const uint CS_PIN_INDEX = 1; + + // Must disable interrupts, as interrupt handlers may be in flash, and we + // are about to temporarily disable flash access! + uint32_t flags = save_and_disable_interrupts(); + + // Set chip select to Hi-Z + hw_write_masked(&ioqspi_hw->io[CS_PIN_INDEX].ctrl, + GPIO_OVERRIDE_LOW << IO_QSPI_GPIO_QSPI_SS_CTRL_OEOVER_LSB, + IO_QSPI_GPIO_QSPI_SS_CTRL_OEOVER_BITS); + + // Note we can't call into any sleep functions in flash right now + for (volatile int i = 0; i < 1000; ++i); + + // The HI GPIO registers in SIO can observe and control the 6 QSPI pins. + // Note the button pulls the pin *low* when pressed. + bool button_state = !(sio_hw->gpio_hi_in & (1u << CS_PIN_INDEX)); + + // Need to restore the state of chip select, else we are going to have a + // bad time when we return to code in flash! + hw_write_masked(&ioqspi_hw->io[CS_PIN_INDEX].ctrl, + GPIO_OVERRIDE_NORMAL << IO_QSPI_GPIO_QSPI_SS_CTRL_OEOVER_LSB, + IO_QSPI_GPIO_QSPI_SS_CTRL_OEOVER_BITS); + + restore_interrupts(flags); + + return button_state; +} + +__Bootsel::operator bool() { + return get_bootsel_button(); +} + +__Bootsel BOOTSEL; diff --git a/cores/rp2040/Bootsel.h b/cores/rp2040/Bootsel.h new file mode 100644 index 000000000..b081ed6ac --- /dev/null +++ b/cores/rp2040/Bootsel.h @@ -0,0 +1,29 @@ +/* + * Simple BOOTSEL reader object + * + * Copyright (c) 2021 Earle F. Philhower, III + * + * 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 + */ + +#pragma once + +class __Bootsel { +public: + __Bootsel() { } + operator bool(); +}; + +extern __Bootsel BOOTSEL; diff --git a/cores/rp2040/CoreMutex.h b/cores/rp2040/CoreMutex.h new file mode 100644 index 000000000..2f26eb406 --- /dev/null +++ b/cores/rp2040/CoreMutex.h @@ -0,0 +1,56 @@ +/* + * CoreMutex for the Raspberry Pi Pico RP2040 + * + * Implements a deadlock-safe multicore mutex for sharing things like the + * USB or UARTs. + * + * Copyright (c) 2021 Earle F. Philhower, III + * + * 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 + */ + +#pragma once + +#include "pico/mutex.h" + +class CoreMutex { +public: + CoreMutex(mutex_t *mutex) { + uint32_t owner; + _mutex = mutex; + _acquired = false; + if (!mutex_try_enter(_mutex, &owner)) { + if (owner == get_core_num()) { // Deadlock! + return; + } + mutex_enter_blocking(_mutex); + } + _acquired = true; + } + + ~CoreMutex() { + if (_acquired) { + mutex_exit(_mutex); + } + } + + operator bool() { + return _acquired; + } + +private: + mutex_t *_mutex; + bool _acquired; +}; diff --git a/cores/rp2040/SerialUART.cpp b/cores/rp2040/SerialUART.cpp index 30d403434..10cf645f5 100644 --- a/cores/rp2040/SerialUART.cpp +++ b/cores/rp2040/SerialUART.cpp @@ -19,29 +19,50 @@ */ #include "SerialUART.h" +#include "CoreMutex.h" #include #include -bool SerialUART::setPinout(pin_size_t tx, pin_size_t rx) { - const uint32_t uart_tx[2] = { 0b000010001000000000001000100000, 0b100000000000100010000000000010 }; - const uint32_t uart_rx[2] = { 0b000001000100000000000100010000, 0b010000000000010001000000000001 }; - if ( ((1 << tx) & uart_tx[uart_get_index(_uart)]) && - ((1 << rx) & uart_rx[uart_get_index(_uart)]) ) { - if (_running) { - pinMode(_tx, INPUT); - pinMode(_rx, INPUT); - } - _tx = tx; +// SerialEvent functions are weak, so when the user doesn't define them, +// the linker just sets their address to 0 (which is checked below). +// The Serialx_available is just a wrapper around Serialx.available(), +// but we can refer to it weakly so we don't pull in the entire +// HardwareSerial instance if the user doesn't also refer to it. +extern void serialEvent1() __attribute__((weak)); +extern void serialEvent2() __attribute__((weak)); + +bool SerialUART::setRX(pin_size_t rx) { + constexpr uint32_t valid[2] = { __bitset({1, 13, 17, 29}) /* UART0 */, + __bitset({5, 9, 21, 25}) /* UART1 */}; + if (_running) { + return false; + } else if ((1 << rx) & valid[uart_get_index(_uart)]) { _rx = rx; - if (_running) { - gpio_set_function(_tx, GPIO_FUNC_UART); - gpio_set_function(_rx, GPIO_FUNC_UART); - } return true; + } else { + return false; } - return false; } +bool SerialUART::setTX(pin_size_t tx) { + constexpr uint32_t valid[2] = { __bitset({0, 12, 16, 28}) /* UART0 */, + __bitset({4, 8, 20, 24}) /* UART1 */}; + if (_running) { + return false; + } else if ((1 << tx) & valid[uart_get_index(_uart)]) { + _tx = tx; + return true; + } else { + return false; + } +} + +SerialUART::SerialUART(uart_inst_t *uart, pin_size_t tx, pin_size_t rx) { + _uart = uart; + _tx = tx; + _rx = rx; + mutex_init(&_mutex); +} void SerialUART::begin(unsigned long baud, uint16_t config) { _baud = baud; @@ -71,12 +92,16 @@ void SerialUART::begin(unsigned long baud, uint16_t config) { } void SerialUART::end() { + if (!_running) { + return; + } uart_deinit(_uart); _running = false; } int SerialUART::peek() { - if (!_running) { + CoreMutex m(&_mutex); + if (!_running || !m) { return -1; } if (_peek >= 0) { @@ -87,7 +112,8 @@ int SerialUART::peek() { } int SerialUART::read() { - if (!_running) { + CoreMutex m(&_mutex); + if (!_running || !m) { return -1; } if (_peek >= 0) { @@ -99,28 +125,32 @@ int SerialUART::read() { } int SerialUART::available() { - if (!_running) { + CoreMutex m(&_mutex); + if (!_running || !m) { return 0; } return (uart_is_readable(_uart)) ? 1 : 0; } int SerialUART::availableForWrite() { - if (!_running) { + CoreMutex m(&_mutex); + if (!_running || !m) { return 0; } return (uart_is_writable(_uart)) ? 1 : 0; } void SerialUART::flush() { - // TODO, must be smarter way. Now, just sleep long enough to guarantee a full FIFO goes out (very conservative) - //int us_per_bit = 1 + (1000000 / _baud); - //delayMicroseconds(us_per_bit * 32 * 8); + CoreMutex m(&_mutex); + if (!_running || !m) { + return; + } uart_default_tx_wait_blocking(); } size_t SerialUART::write(uint8_t c) { - if (!_running) { + CoreMutex m(&_mutex); + if (!_running || !m) { return 0; } uart_putc_raw(_uart, c); @@ -128,7 +158,8 @@ size_t SerialUART::write(uint8_t c) { } size_t SerialUART::write(const uint8_t *p, size_t len) { - if (!_running) { + CoreMutex m(&_mutex); + if (!_running || !m) { return 0; } size_t cnt = len; @@ -147,3 +178,14 @@ SerialUART::operator bool() { SerialUART Serial1(uart0, 0, 1); SerialUART Serial2(uart1, 4, 5); +void arduino::serialEvent1Run(void) { + if (serialEvent1 && Serial1.available()) { + serialEvent1(); + } +} + +void arduino::serialEvent2Run(void) { + if (serialEvent2 && Serial2.available()) { + serialEvent2(); + } +} diff --git a/cores/rp2040/SerialUART.h b/cores/rp2040/SerialUART.h index b6246a6cb..aa2119e70 100644 --- a/cores/rp2040/SerialUART.h +++ b/cores/rp2040/SerialUART.h @@ -24,14 +24,18 @@ #include #include "api/HardwareSerial.h" #include +#include "CoreMutex.h" extern "C" typedef struct uart_inst uart_inst_t; class SerialUART : public HardwareSerial { public: - SerialUART(uart_inst_t *uart, pin_size_t tx, pin_size_t rx) { _uart = uart; _tx = tx; _rx = rx; } + SerialUART(uart_inst_t *uart, pin_size_t tx, pin_size_t rx); - bool setPinout(pin_size_t tx, pin_size_t rx); + // Select the pinout. Call before .begin() + bool setRX(pin_size_t pin); + bool setTX(pin_size_t pin); + bool setPinout(pin_size_t tx, pin_size_t rx) { bool ret = setRX(rx); ret &= setTX(tx); return ret; } void begin(unsigned long baud = 115200) override { begin(baud, SERIAL_8N1); }; void begin(unsigned long baud, uint16_t config) override; @@ -76,9 +80,15 @@ class SerialUART : public HardwareSerial { pin_size_t _tx, _rx; int _baud; int _peek; + mutex_t _mutex; }; extern SerialUART Serial1; // HW UART 0 extern SerialUART Serial2; // HW UART 1 +namespace arduino { + extern void serialEvent1Run(void) __attribute__((weak)); + extern void serialEvent2Run(void) __attribute__((weak)); +}; + #endif diff --git a/cores/rp2040/SerialUSB.cpp b/cores/rp2040/SerialUSB.cpp index 295bd5f3b..d538bbb55 100644 --- a/cores/rp2040/SerialUSB.cpp +++ b/cores/rp2040/SerialUSB.cpp @@ -21,24 +21,34 @@ */ #include - +#include "CoreMutex.h" #include "tusb.h" #include "pico/time.h" #include "pico/binary_info.h" -extern "C" { - #include "pico/bootrom.h" -} +#include "pico/bootrom.h" #include "hardware/irq.h" #include "pico/mutex.h" #include "hardware/watchdog.h" #include "pico/unique_id.h" +// SerialEvent functions are weak, so when the user doesn't define them, +// the linker just sets their address to 0 (which is checked below). +// The Serialx_available is just a wrapper around Serialx.available(), +// but we can refer to it weakly so we don't pull in the entire +// HardwareSerial instance if the user doesn't also refer to it. +extern void serialEvent() __attribute__((weak)); + #define PICO_STDIO_USB_TASK_INTERVAL_US 1000 #define PICO_STDIO_USB_LOW_PRIORITY_IRQ 31 #define USBD_VID (0x2E8A) // Raspberry Pi -#define USBD_PID (0x000a) // Raspberry Pi Pico SDK CDC + +#ifdef SERIALUSB_PID + #define USBD_PID (SERIALUSB_PID) +#else + #define USBD_PID (0x000a) // Raspberry Pi Pico SDK CDC +#endif #define USBD_DESC_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN) #define USBD_MAX_POWER_MA (250) @@ -64,7 +74,7 @@ static const tusb_desc_device_t usbd_desc_device = { .bLength = sizeof(tusb_desc_device_t), .bDescriptorType = TUSB_DESC_DEVICE, .bcdUSB = 0x0200, - .bDeviceClass = TUSB_CLASS_MISC, + .bDeviceClass = TUSB_CLASS_CDC, .bDeviceSubClass = MISC_SUBCLASS_COMMON, .bDeviceProtocol = MISC_PROTOCOL_IAD, .bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE, @@ -178,90 +188,101 @@ void SerialUSB::end() { } int SerialUSB::peek() { - uint8_t c; - uint32_t owner; - if (!mutex_try_enter(&usb_mutex, &owner)) { - if (owner == get_core_num()) return -1; // would deadlock otherwise - mutex_enter_blocking(&usb_mutex); + CoreMutex m(&usb_mutex); + if (!_running || !m) { + return 0; } - auto ret = tud_cdc_peek(0, &c) ? (int) c : -1; - mutex_exit(&usb_mutex); - return ret; + + uint8_t c; + return tud_cdc_peek(0, &c) ? (int) c : -1; } int SerialUSB::read() { - uint32_t owner; - if (!mutex_try_enter(&usb_mutex, &owner)) { - if (owner == get_core_num()) return -1; // would deadlock otherwise - mutex_enter_blocking(&usb_mutex); + CoreMutex m(&usb_mutex); + if (!_running || !m) { + return -1; } + if (tud_cdc_connected() && tud_cdc_available()) { - int ch = tud_cdc_read_char(); - mutex_exit(&usb_mutex); - return ch; + return tud_cdc_read_char(); } - mutex_exit(&usb_mutex); return -1; } + int SerialUSB::available() { - uint32_t owner; - if (!mutex_try_enter(&usb_mutex, &owner)) { - if (owner == get_core_num()) return 0; // would deadlock otherwise - mutex_enter_blocking(&usb_mutex); + CoreMutex m(&usb_mutex); + if (!_running || !m) { + return 0; } - auto ret = tud_cdc_available(); - mutex_exit(&usb_mutex); - return ret; + + return tud_cdc_available(); } + int SerialUSB::availableForWrite() { - uint32_t owner; - if (!mutex_try_enter(&usb_mutex, &owner)) { - if (owner == get_core_num()) return 0; // would deadlock otherwise - mutex_enter_blocking(&usb_mutex); + CoreMutex m(&usb_mutex); + if (!_running || !m) { + return 0; } - auto ret = tud_cdc_write_available(); - mutex_exit(&usb_mutex); - return ret; + + return tud_cdc_write_available(); } + void SerialUSB::flush() { - uint32_t owner; - if (!mutex_try_enter(&usb_mutex, &owner)) { - if (owner == get_core_num()) return; // would deadlock otherwise - mutex_enter_blocking(&usb_mutex); + CoreMutex m(&usb_mutex); + if (!_running || !m) { + return; } + tud_cdc_write_flush(); - mutex_exit(&usb_mutex); } + size_t SerialUSB::write(uint8_t c) { return write(&c, 1); } -size_t SerialUSB::write(const uint8_t *p, size_t len) { - uint32_t owner; - if (!mutex_try_enter(&usb_mutex, &owner)) { - if (owner == get_core_num()) return 0; // would deadlock otherwise - mutex_enter_blocking(&usb_mutex); + +size_t SerialUSB::write(const uint8_t *buf, size_t length) { + CoreMutex m(&usb_mutex); + if (!_running || !m) { + return 0; } - size_t remain = len; - while (remain && tud_cdc_connected()) { - size_t cnt = tud_cdc_write(p, remain); - p += cnt; - remain -= cnt; - tud_task(); - tud_cdc_write_flush(); + + static uint64_t last_avail_time; + int i = 0; + if (tud_cdc_connected()) { + for (int i = 0; i < length;) { + int n = length - i; + int avail = tud_cdc_write_available(); + if (n > avail) n = avail; + if (n) { + int n2 = tud_cdc_write(buf + i, n); + tud_task(); + tud_cdc_write_flush(); + i += n2; + last_avail_time = time_us_64(); + } else { + tud_task(); + tud_cdc_write_flush(); + if (!tud_cdc_connected() || + (!tud_cdc_write_available() && time_us_64() > last_avail_time + 1000000 /* 1 second */)) { + break; + } + } + } + } else { + // reset our timeout + last_avail_time = 0; } - mutex_exit(&usb_mutex); - return len - remain; + return i; } + SerialUSB::operator bool() { - uint32_t owner; - if (!mutex_try_enter(&usb_mutex, &owner)) { - if (owner == get_core_num()) return -1; // would deadlock otherwise - mutex_enter_blocking(&usb_mutex); + CoreMutex m(&usb_mutex); + if (!_running || !m) { + return false; } + tud_task(); - auto ret = tud_cdc_connected(); - mutex_exit(&usb_mutex); - return ret; + return tud_cdc_connected(); } @@ -286,5 +307,11 @@ extern "C" void tud_cdc_line_coding_cb(uint8_t itf, cdc_line_coding_t const* p_l CheckSerialReset(); } - SerialUSB Serial; + +void arduino::serialEventRun(void) +{ + if (serialEvent && Serial.available()) { + serialEvent(); + } +} diff --git a/cores/rp2040/SerialUSB.h b/cores/rp2040/SerialUSB.h index dbdae7e19..3c00b5f33 100644 --- a/cores/rp2040/SerialUSB.h +++ b/cores/rp2040/SerialUSB.h @@ -72,4 +72,8 @@ class SerialUSB : public HardwareSerial { extern SerialUSB Serial; +namespace arduino { + extern void serialEventRun(void) __attribute__((weak)); +}; + #endif diff --git a/cores/rp2040/WMath.cpp b/cores/rp2040/WMath.cpp new file mode 100644 index 000000000..2c6cdc3fe --- /dev/null +++ b/cores/rp2040/WMath.cpp @@ -0,0 +1,52 @@ +/* + Copyright (c) 2014 Arduino. 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 +*/ + +extern "C" { + #include "stdlib.h" + #include "stdint.h" +} + +void randomSeed( uint32_t dwSeed ) +{ + if ( dwSeed != 0 ) + { + srand( dwSeed ) ; + } +} + +long random( long howbig ) +{ + if ( howbig == 0 ) + { + return 0 ; + } + + return rand() % howbig; +} + +long random( long howsmall, long howbig ) +{ + if (howsmall >= howbig) + { + return howsmall; + } + + long diff = howbig - howsmall; + + return random(diff) + howsmall; +} diff --git a/cores/rp2040/api b/cores/rp2040/api new file mode 120000 index 000000000..add00d9e4 --- /dev/null +++ b/cores/rp2040/api @@ -0,0 +1 @@ +../../ArduinoCore-API/api/ \ No newline at end of file diff --git a/cores/rp2040/main.cpp b/cores/rp2040/main.cpp index d56d0cef7..f9fb4c05c 100644 --- a/cores/rp2040/main.cpp +++ b/cores/rp2040/main.cpp @@ -19,15 +19,36 @@ */ #include +#include extern void setup(); extern void loop(); extern "C" int main() { +#if F_CPU != 125000000 + set_sys_clock_khz(F_CPU / 1000, true); +#endif + +#ifndef DISABLE_USB_SERIAL + // Enable serial port for reset/upload always Serial.begin(); +#endif + +#if defined DEBUG_RP2040_PORT + DEBUG_RP2040_PORT.begin(); +#endif setup(); while (1) { loop(); + if (arduino::serialEventRun) { + arduino::serialEventRun(); + } + if (arduino::serialEvent1Run) { + arduino::serialEvent1Run(); + } + if (arduino::serialEvent2Run) { + arduino::serialEvent2Run(); + } } return 0; } @@ -50,7 +71,11 @@ extern "C" int main() { extern "C" int errno; extern "C" ssize_t _write(int fd, const void *buf, size_t count) { - return Serial.write((const char *)buf, count); +#if defined DEBUG_RP2040_PORT + return DEBUG_RP2040_PORT.write((const char *)buf, count); +#else + return 0; +#endif } extern "C" int _chown (const char *path, uid_t owner, gid_t group) { diff --git a/cores/rp2040/millis.cpp b/cores/rp2040/millis.cpp index 83d27c711..143de387e 100644 --- a/cores/rp2040/millis.cpp +++ b/cores/rp2040/millis.cpp @@ -24,3 +24,6 @@ extern "C" unsigned long millis() { return to_ms_since_boot(get_absolute_time()); } +extern "C" unsigned long micros() { + return time_us_32(); +} diff --git a/cores/rp2040/stdlib_noniso.cpp b/cores/rp2040/stdlib_noniso.cpp new file mode 100644 index 000000000..fbed0a8d7 --- /dev/null +++ b/cores/rp2040/stdlib_noniso.cpp @@ -0,0 +1,186 @@ +/* + stdlib_noniso.h - nonstandard (but useful) conversion functions + + Copyright (c) 2014 Ivan Grokhotkov. All rights reserved. + Copyright (c) 2021 David Gauchard. All rights reserved. + This file is part of the esp8266 core for Arduino environment. + + 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 +*/ + +#include +#include +#include +#include +#include +#include +#include "stdlib_noniso.h" + +// ulltoa() is slower than std::to_char() (1.6 times) +// but is smaller by ~800B/flash and ~250B/rodata + +// ulltoa fills str backwards and can return a pointer different from str +extern "C" char* ulltoa(unsigned long long val, char* str, int slen, unsigned int radix) +{ + str += --slen; + *str = 0; + do + { + auto mod = val % radix; + val /= radix; + *--str = mod + ((mod > 9) ? ('a' - 10) : '0'); + } while (--slen && val); + return val? nullptr: str; +} + +// lltoa fills str backwards and can return a pointer different from str +extern "C" char* lltoa (long long val, char* str, int slen, unsigned int radix) +{ + bool neg; + if (val < 0) + { + val = -val; + neg = true; + } + else + { + neg = false; + } + char* ret = ulltoa(val, str, slen, radix); + if (neg) + { + if (ret == str || ret == nullptr) + return nullptr; + *--ret = '-'; + } + return ret; +} + +extern "C" char* ltoa(long value, char* result, int base) { + return itoa((int)value, result, base); +} + +extern "C" char* ultoa(unsigned long value, char* result, int base) { + return utoa((unsigned int)value, result, base); +} + +extern "C" char * dtostrf(double number, signed char width, unsigned char prec, char *s) { + bool negative = false; + + if (isnan(number)) { + strcpy(s, "nan"); + return s; + } + if (isinf(number)) { + strcpy(s, "inf"); + return s; + } + + char* out = s; + + int fillme = width; // how many cells to fill for the integer part + if (prec > 0) { + fillme -= (prec+1); + } + + // Handle negative numbers + if (number < 0.0) { + negative = true; + fillme--; + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + // I optimized out most of the divisions + double rounding = 2.0; + for (uint8_t i = 0; i < prec; ++i) + rounding *= 10.0; + rounding = 1.0 / rounding; + + number += rounding; + + // Figure out how big our number really is + double tenpow = 1.0; + int digitcount = 1; + double nextpow; + while (number >= (nextpow = (10.0 * tenpow))) { + tenpow = nextpow; + digitcount++; + } + + // minimal compensation for possible lack of precision (#7087 addition) + number *= 1 + std::numeric_limits::epsilon(); + + number /= tenpow; + fillme -= digitcount; + + // Pad unused cells with spaces + while (fillme-- > 0) { + *out++ = ' '; + } + + // Handle negative sign + if (negative) *out++ = '-'; + + // Print the digits, and if necessary, the decimal point + digitcount += prec; + int8_t digit = 0; + while (digitcount-- > 0) { + digit = (int8_t)number; + if (digit > 9) digit = 9; // insurance + *out++ = (char)('0' | digit); + if ((digitcount == prec) && (prec > 0)) { + *out++ = '.'; + } + number -= digit; + number *= 10.0; + } + + // make sure the string is terminated + *out = 0; + return s; +} + +/* + strrstr (static) + + Backwards search for p_pcPattern in p_pcString + Based on: https://stackoverflow.com/a/1634398/2778898 + +*/ +extern "C" const char* strrstr(const char*__restrict p_pcString, + const char*__restrict p_pcPattern) +{ + const char* pcResult = 0; + + size_t stStringLength = (p_pcString ? strlen(p_pcString) : 0); + size_t stPatternLength = (p_pcPattern ? strlen(p_pcPattern) : 0); + + if ((stStringLength) && + (stPatternLength) && + (stPatternLength <= stStringLength)) + { + // Pattern is shorter or has the same length than the string + for (const char* s = (p_pcString + stStringLength - stPatternLength); s >= p_pcString; --s) + { + if (0 == strncmp(s, p_pcPattern, stPatternLength)) + { + pcResult = s; + break; + } + } + } + return pcResult; +} diff --git a/cores/rp2040/stdlib_noniso.h b/cores/rp2040/stdlib_noniso.h new file mode 100644 index 000000000..f86f78bef --- /dev/null +++ b/cores/rp2040/stdlib_noniso.h @@ -0,0 +1,59 @@ +/* + stdlib_noniso.h - nonstandard (but useful) conversion functions + + Copyright (c) 2014 Ivan Grokhotkov. All rights reserved. + This file is part of the esp8266 core for Arduino environment. + + 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 STDLIB_NONISO_H +#define STDLIB_NONISO_H + +#ifdef __cplusplus +extern "C"{ +#endif + +int atoi(const char *s); + +long atol(const char* s); + +double atof(const char* s); + +char* itoa (int val, char *s, int radix); + +char* ltoa (long val, char *s, int radix); + +char* lltoa (long long val, char* str, int slen, unsigned int radix); + +char* utoa (unsigned int val, char *s, int radix); + +char* ultoa (unsigned long val, char *s, int radix); + +char* ulltoa (unsigned long long val, char* str, int slen, unsigned int radix); + +char* dtostrf (double val, signed char width, unsigned char prec, char *s); + +void reverse(char* begin, char* end); + +const char* strrstr(const char*__restrict p_pcString, + const char*__restrict p_pcPattern); + +#ifdef __cplusplus +} // extern "C" +#endif + + +#endif diff --git a/cores/rp2040/wiring_digital.cpp b/cores/rp2040/wiring_digital.cpp index dffd332cf..7cdd598be 100644 --- a/cores/rp2040/wiring_digital.cpp +++ b/cores/rp2040/wiring_digital.cpp @@ -21,6 +21,8 @@ #include "Arduino.h" #include +static PinMode _pm[30]; + extern "C" void pinMode( pin_size_t ulPin, PinMode ulMode ) { switch (ulMode) { case INPUT: @@ -31,11 +33,13 @@ extern "C" void pinMode( pin_size_t ulPin, PinMode ulMode ) { gpio_init(ulPin); gpio_set_dir(ulPin, false); gpio_pull_up(ulPin); + gpio_put(ulPin, 0); break; case INPUT_PULLDOWN: gpio_init(ulPin); gpio_set_dir(ulPin, false); gpio_pull_down(ulPin); + gpio_put(ulPin, 1); break; case OUTPUT: gpio_init(ulPin); @@ -43,16 +47,23 @@ extern "C" void pinMode( pin_size_t ulPin, PinMode ulMode ) { break; default: // Error - break; + return; } + _pm[ulPin] = ulMode; } extern "C" void digitalWrite( pin_size_t ulPin, PinStatus ulVal ) { - if (!gpio_is_dir_out(ulPin)) { + if (_pm[ulPin] == INPUT_PULLDOWN) { if (ulVal == LOW) { - gpio_pull_down(ulPin); + gpio_set_dir(ulPin, false); } else { - gpio_pull_up(ulPin); + gpio_set_dir(ulPin, true); + } + } else if (_pm[ulPin] == INPUT_PULLUP) { + if (ulVal == HIGH) { + gpio_set_dir(ulPin, false); + } else { + gpio_set_dir(ulPin, true); } } else { gpio_put(ulPin, ulVal == LOW ? 0 : 1); diff --git a/cores/rp2040/wiring_private.cpp b/cores/rp2040/wiring_private.cpp index 548ce3b55..e9673011e 100644 --- a/cores/rp2040/wiring_private.cpp +++ b/cores/rp2040/wiring_private.cpp @@ -19,21 +19,64 @@ */ #include +#include #include #include +#include -std::stack irqStack; +// Support nested IRQ disable/re-enable +static std::stack _irqStack; extern "C" void interrupts() { - if (irqStack.empty()) { + if (_irqStack.empty()) { // ERROR return; } - restore_interrupts(irqStack.top()); - irqStack.pop(); + restore_interrupts(_irqStack.top()); + _irqStack.pop(); } extern "C" void noInterrupts() { - irqStack.push(save_and_disable_interrupts()); + _irqStack.push(save_and_disable_interrupts()); } +// Only 1 GPIO IRQ callback for all pins, so we need to look at the pin it's for and +// dispatch to the real callback manually +static std::map _map; + +void _gpioInterruptDispatcher(uint gpio, uint32_t events) { + auto irq = _map.find(gpio); + if (irq != _map.end()) { + // Ignore events, only one event per pin supported by Arduino + irq->second(); // Do the callback + } else { + // ERROR, but we're in an IRQ so do nothing + } +} + +extern "C" void attachInterrupt(pin_size_t pin, voidFuncPtr callback, PinStatus mode) { + uint32_t events; + switch (mode) { + case LOW: events = 1; break; + case HIGH: events = 2; break; + case FALLING: events = 4; break; + case RISING: events = 8; break; + case CHANGE: events = 4 | 8; break; + default: return; // ERROR + } + noInterrupts(); + detachInterrupt(pin); + _map.insert({pin, callback}); + gpio_set_irq_enabled_with_callback(pin, events, true, _gpioInterruptDispatcher); + interrupts(); +} + +extern "C" void detachInterrupt(pin_size_t pin) { + noInterrupts(); + auto irq = _map.find(pin); + if (irq != _map.end()) { + gpio_set_irq_enabled(pin, 0x0f /* all */, false); + _map.erase(pin); + } + interrupts(); +} diff --git a/cores/rp2040/wiring_private.h b/cores/rp2040/wiring_private.h new file mode 100644 index 000000000..2997587d8 --- /dev/null +++ b/cores/rp2040/wiring_private.h @@ -0,0 +1 @@ +/* dummy */ diff --git a/lib/libpico.a b/lib/libpico.a index cb2f23d98..37a622f40 100644 Binary files a/lib/libpico.a and b/lib/libpico.a differ diff --git a/variants/generic/memmap_default.ld b/lib/memmap_default.ld similarity index 97% rename from variants/generic/memmap_default.ld rename to lib/memmap_default.ld index 1a5a0ef5c..a69b1de54 100644 --- a/variants/generic/memmap_default.ld +++ b/lib/memmap_default.ld @@ -23,12 +23,14 @@ MEMORY { - FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2044k /* 2048 - 4K for EEPROM */ + FLASH(rx) : ORIGIN = 0x10000000, LENGTH = __FLASH_LENGTH__ RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k } -PROVIDE ( _EEPROM_start = 0x101FF000 ); +PROVIDE ( _EEPROM_start = __EEPROM_START__ ); +PROVIDE ( _FS_start = __FS_START__ ); +PROVIDE ( _FS_end = __FS_END__ ); ENTRY(_entry_point) diff --git a/libraries/EEPROM/EEPROM.cpp b/libraries/EEPROM/EEPROM.cpp index cc9c532ee..ee8198f69 100644 --- a/libraries/EEPROM/EEPROM.cpp +++ b/libraries/EEPROM/EEPROM.cpp @@ -22,10 +22,7 @@ #include #include "EEPROM.h" -extern "C" { -// This header is missing the "ifdef cplusplus extern C" bit #include -} #include extern "C" uint8_t _EEPROM_start; @@ -40,7 +37,7 @@ void EEPROMClass::begin(size_t size) { size = 4096; } - size = (size + 255) & (~255); // Flash writes limited to 256 byte boundaries + _size = (size + 255) & (~255); // Flash writes limited to 256 byte boundaries // In case begin() is called a 2nd+ time, don't reallocate if size is the same if (_data && size != _size) { diff --git a/libraries/SPI/SPI.cpp b/libraries/SPI/SPI.cpp index e00d1af63..6e57bc370 100644 --- a/libraries/SPI/SPI.cpp +++ b/libraries/SPI/SPI.cpp @@ -24,6 +24,7 @@ SPIClassRP2040::SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_size_t sck, pin_size_t tx) { _spi = spi; + _running = false; _initted = false; _spis = SPISettings(); _RX = rx; @@ -143,42 +144,57 @@ void SPIClassRP2040::endTransaction(void) { } bool SPIClassRP2040::setRX(pin_size_t pin) { - const uint32_t valid[2] = { 0b10001000000000001000100000000000, 0b00000000100010000000000010001000 }; - if ( (1 << pin) & valid[spi_get_index(_spi)] ) { + constexpr uint32_t valid[2] = { __bitset({0, 4, 16, 20}) /* SPI0 */, + __bitset({8, 12, 24, 28}) /* SPI1 */}; + if (_running) { + return false; + } else if ((1 << pin) & valid[spi_get_index(_spi)]) { _RX = pin; return true; + } else { + return false; } - return false; } bool SPIClassRP2040::setCS(pin_size_t pin) { - const uint32_t valid[2] = { 0b01000100000000000100010000000000, 0b00000000010001000000000001000100 }; - if ( (1 << pin) & valid[spi_get_index(_spi)] ) { + constexpr uint32_t valid[2] = { __bitset({1, 5, 17, 21}) /* SPI0 */, + __bitset({9, 13, 25, 29}) /* SPI1 */}; + if (_running) { + return false; + } else if ((1 << pin) & valid[spi_get_index(_spi)]) { _CS = pin; return true; + } else { + return false; } - return false; } bool SPIClassRP2040::setSCK(pin_size_t pin) { - const uint32_t valid[2] = { 0b00100010000000000010001000000000, 0b00000000001000100000000000100010 }; - if ( (1 << pin) & valid[spi_get_index(_spi)] ) { + constexpr uint32_t valid[2] = { __bitset({2, 6, 18, 22}) /* SPI0 */, + __bitset({10, 14, 26}) /* SPI1 */}; + if (_running) { + return false; + } else if ((1 << pin) & valid[spi_get_index(_spi)]) { _SCK = pin; return true; + } else { + return false; } - return false; } bool SPIClassRP2040::setTX(pin_size_t pin) { - const uint32_t valid[2] = { 0b00010001000000000001000100000000, 0b00000000000100010000000000010001 }; - if ( (1 << pin) & valid[spi_get_index(_spi)] ) { + constexpr uint32_t valid[2] = { __bitset({3, 7, 19, 23}) /* SPI0 */, + __bitset({11, 15, 27}) /* SPI1 */}; + if (_running) { + return false; + } else if ((1 << pin) & valid[spi_get_index(_spi)]) { _TX = pin; return true; + } else { + return false; } - return false; } - void SPIClassRP2040::begin(bool hwCS) { DEBUGSPI("SPI::begin(%d), rx=%d, cs=%d, sck=%d, tx=%d\n", hwCS, _RX, _CS, _SCK, _TX); gpio_set_function(_RX, GPIO_FUNC_SPI); diff --git a/libraries/SPI/SPI.h b/libraries/SPI/SPI.h index b80b93aa6..f3b9ab273 100644 --- a/libraries/SPI/SPI.h +++ b/libraries/SPI/SPI.h @@ -73,7 +73,8 @@ class SPIClassRP2040 : public arduino::HardwareSPI { SPISettings _spis; pin_size_t _RX, _TX, _SCK, _CS; bool _hwCS; - bool _initted; + bool _running; // SPI port active + bool _initted; // Transaction begun }; extern SPIClassRP2040 SPI; diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp index c7a68b244..9692d2a8c 100644 --- a/libraries/Wire/Wire.cpp +++ b/libraries/Wire/Wire.cpp @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include "Wire.h" TwoWire::TwoWire(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl) { @@ -31,25 +33,35 @@ TwoWire::TwoWire(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl) { _scl = scl; _i2c = i2c; _clkHz = TWI_CLOCK; - _begun = false; + _running = false; _txBegun = false; _buffLen = 0; } bool TwoWire::setSDA(pin_size_t pin) { - if (sdaAllowed(pin)) { + constexpr uint32_t valid[2] = { __bitset({0, 4, 8, 12, 16, 20, 24, 28}) /* I2C0 */, + __bitset({2, 6, 10, 14, 18, 22, 26}) /* I2C1 */}; + if (_running) { + return false; + } else if ((1 << pin) & valid[i2c_hw_index(_i2c)]) { _sda = pin; return true; + } else { + return false; } - return false; } bool TwoWire::setSCL(pin_size_t pin) { - if (sclAllowed(pin)) { + constexpr uint32_t valid[2] = { __bitset({1, 5, 9, 13, 17, 21, 25, 29}) /* I2C0 */, + __bitset({3, 7, 11, 15, 19, 23, 27}) /* I2C1 */}; + if (_running) { + return false; + } else if ((1 << pin) & valid[i2c_hw_index(_i2c)]) { _scl = pin; return true; + } else { + return false; } - return false; } void TwoWire::setClock(uint32_t hz) { @@ -58,7 +70,7 @@ void TwoWire::setClock(uint32_t hz) { // Master mode void TwoWire::begin() { - if (_begun) { + if (_running) { // ERROR return; } @@ -70,42 +82,90 @@ void TwoWire::begin() { gpio_set_function(_scl, GPIO_FUNC_I2C); gpio_pull_up(_scl); - _begun = true; + _running = true; _txBegun = false; _buffLen = 0; } +static void _handler0() { + Wire.onIRQ(); +} + +static void _handler1() { + Wire1.onIRQ(); +} + // Slave mode void TwoWire::begin(uint8_t addr) { - // Slave mode isn't documented in the SDK, need to twiddle raw registers - // and use bare interrupts. TODO to implement, for now. -#if 0 - if (_begun) { + if (_running) { // ERROR return; } _slave = true; i2c_init(_i2c, _clkHz); i2c_set_slave_mode(_i2c, true, addr); + + // Our callback IRQ + _i2c->hw->intr_mask = (1<<10) | (1<<9) | (1<<5)| (1<<2); + + int irqNo = I2C0_IRQ + i2c_hw_index(_i2c); + irq_set_exclusive_handler(irqNo, i2c_hw_index(_i2c) == 0 ? _handler0 : _handler1); + irq_set_enabled(irqNo, true); + + gpio_set_function(_sda, GPIO_FUNC_I2C); gpio_pull_up(_sda); gpio_set_function(_scl, GPIO_FUNC_I2C); gpio_pull_up(_scl); -#endif + + _running = true; +} + +void TwoWire::onIRQ() { + if (_i2c->hw->intr_stat & (1<<10)) { + _buffLen = 0; + _buffOff = 0; + _slaveStartDet = true; + _i2c->hw->clr_start_det; + } + if (_i2c->hw->intr_stat & (1<<9)) { + if (_onReceiveCallback) { + _onReceiveCallback(_buffLen); + } + _buffLen = 0; + _buffOff = 0; + _slaveStartDet = false; + _i2c->hw->clr_stop_det; + } + if (_i2c->hw->intr_stat & (1<<5)) { + // RD_REQ + if (_onRequestCallback) { + _onRequestCallback(); + } + _i2c->hw->clr_rd_req; + } + if (_i2c->hw->intr_stat & (1<<2)) { + // RX_FULL + if (_slaveStartDet && (_buffLen < sizeof(_buff))) { + _buff[_buffLen++] = _i2c->hw->data_cmd & 0xff; + } else { + _i2c->hw->data_cmd; + } + } } void TwoWire::end() { - if (!_begun) { + if (!_running) { // ERROR return; } i2c_deinit(_i2c); - _begun = false; + _running = false; _txBegun = false; } void TwoWire::beginTransmission(uint8_t addr) { - if (!_begun || _txBegun) { + if (!_running || _txBegun) { // ERROR return; } @@ -114,61 +174,13 @@ void TwoWire::beginTransmission(uint8_t addr) { _txBegun = true; } -bool TwoWire::sdaAllowed(pin_size_t pin) { - switch (i2c_hw_index(_i2c)) { - case 0: - switch (pin) { - case 0: - case 4: - case 16: - case 20: - return true; - } - break; - case 1: - switch (pin) { - case 8: - case 12: - case 24: - case 28: - return true; - } - break; - } - return false; -} - -bool TwoWire::sclAllowed(pin_size_t pin) { - switch (i2c_hw_index(_i2c)) { - case 0: - switch (pin) { - case 1: - case 5: - case 17: - case 21: - return true; - } - break; - case 1: - switch (pin) { - case 9: - case 13: - case 25: - case 29: - return true; - } - break; - } - return false; -} - size_t TwoWire::requestFrom(uint8_t address, size_t quantity, bool stopBit) { - if (!_begun || _txBegun || !quantity || (quantity > sizeof(_buff))) { + if (!_running || _txBegun || !quantity || (quantity > sizeof(_buff))) { return 0; } size_t byteRead = 0; - _buffLen = i2c_read_blocking(_i2c, address, _buff, quantity, !stopBit); + _buffLen = i2c_read_blocking_until(_i2c, address, _buff, quantity, !stopBit, make_timeout_time_ms(50)); _buffOff = 0; return _buffLen; } @@ -177,6 +189,63 @@ size_t TwoWire::requestFrom(uint8_t address, size_t quantity) { return requestFrom(address, quantity, true); } +static bool _clockStretch(pin_size_t pin) { + auto end = time_us_64() + 100; + while ((time_us_64() < end) && (!digitalRead(pin))) { /* noop */ } + return digitalRead(pin); +} + +bool _probe(int addr, pin_size_t sda, pin_size_t scl, int freq) { + int delay = (1000000 / freq) / 2; + bool ack = false; + + pinMode(sda, INPUT_PULLUP); + pinMode(scl, INPUT_PULLUP); + gpio_set_function(scl, GPIO_FUNC_SIO); + gpio_set_function(sda, GPIO_FUNC_SIO); + + digitalWrite(sda, HIGH); + sleep_us(delay); + digitalWrite(scl, HIGH); + if (!_clockStretch(scl)) goto stop; + digitalWrite(sda, LOW); + sleep_us(delay); + digitalWrite(scl, LOW); + sleep_us(delay); + for (int i=0; i<8; i++) { + addr <<= 1; + digitalWrite(sda, (addr & (1<<7)) ? HIGH : LOW); + sleep_us(delay); + digitalWrite(scl, HIGH); + sleep_us(delay); + if (!_clockStretch(scl)) goto stop; + digitalWrite(scl, LOW); + sleep_us(5); // Ensure we don't change too close to clock edge + } + + digitalWrite(sda, HIGH); + sleep_us(delay); + digitalWrite(scl, HIGH); + if (!_clockStretch(scl)) goto stop; + + ack = digitalRead(sda) == LOW; + sleep_us(delay); + digitalWrite(scl, LOW); + +stop: + sleep_us(delay); + digitalWrite(sda, LOW); + sleep_us(delay); + digitalWrite(scl, HIGH); + sleep_us(delay); + digitalWrite(sda, HIGH); + sleep_us(delay); + gpio_set_function(scl, GPIO_FUNC_I2C); + gpio_set_function(sda, GPIO_FUNC_I2C); + + return ack; +} + // Errors: // 0 : Success // 1 : Data too long @@ -184,14 +253,19 @@ size_t TwoWire::requestFrom(uint8_t address, size_t quantity) { // 3 : NACK on transmit of data // 4 : Other error uint8_t TwoWire::endTransmission(bool stopBit) { - if (!_begun || !_txBegun || !_buffLen) { + if (!_running || !_txBegun) { return 4; } - auto len = _buffLen; - auto ret = i2c_write_blocking(_i2c, _addr, _buff, _buffLen, !stopBit); - _buffLen = 0; _txBegun = false; - return (ret == len) ? 0 : 4; + if (!_buffLen) { + // Special-case 0-len writes which are used for I2C probing + 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)); + _buffLen = 0; + return (ret == len) ? 0 : 4; + } } uint8_t TwoWire::endTransmission() { @@ -199,11 +273,22 @@ uint8_t TwoWire::endTransmission() { } size_t TwoWire::write(uint8_t ucData) { - if (!_begun || !_txBegun || (_buffLen == sizeof(_buff))) { + if (!_running) { return 0; } - _buff[_buffLen++] = ucData; - return 1 ; + + if (_slave) { + // Wait for a spot in the TX FIFO + while (0 == _i2c->hw->status & (1<<1)) { /* noop wait */ } + _i2c->hw->data_cmd = ucData; + return 1; + } else { + if (!_txBegun || (_buffLen == sizeof(_buff))) { + return 0; + } + _buff[_buffLen++] = ucData; + return 1 ; + } } size_t TwoWire::write(const uint8_t *data, size_t quantity) { @@ -217,7 +302,7 @@ size_t TwoWire::write(const uint8_t *data, size_t quantity) { } int TwoWire::available(void) { - return _begun ? _buffLen - _buffOff : 0; + return _running ? _buffLen - _buffOff : 0; } int TwoWire::read(void) { @@ -251,5 +336,4 @@ void TwoWire::onRequest(void(*function)(void)) } TwoWire Wire(i2c0, 0, 1); -TwoWire Wire1(i2c1, 4, 5); - +TwoWire Wire1(i2c1, 2, 3); diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h index 1ec99b000..906007b8c 100644 --- a/libraries/Wire/Wire.h +++ b/libraries/Wire/Wire.h @@ -40,30 +40,32 @@ class TwoWire : public HardwareI2C { TwoWire(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl); // Start as Master - void begin(); + void begin() override; // Start as Slave - void begin(uint8_t address); + void begin(uint8_t address) override; // Shut down the I2C interface - void end(); + void end() override; + // Select IO pins to use. Call before ::begin() bool setSDA(pin_size_t sda); bool setSCL(pin_size_t scl); + void setClock(uint32_t freqHz) override; - void beginTransmission(uint8_t); - uint8_t endTransmission(bool stopBit); - uint8_t endTransmission(void); + void beginTransmission(uint8_t) override; + uint8_t endTransmission(bool stopBit) override; + uint8_t endTransmission(void) override; - size_t requestFrom(uint8_t address, size_t quantity, bool stopBit); - size_t requestFrom(uint8_t address, size_t quantity); + size_t requestFrom(uint8_t address, size_t quantity, bool stopBit) override; + size_t requestFrom(uint8_t address, size_t quantity) override; - size_t write(uint8_t data); - size_t write(const uint8_t * data, size_t quantity); + size_t write(uint8_t data) override; + size_t write(const uint8_t * data, size_t quantity) override; - virtual int available(void); - virtual int read(void); - virtual int peek(void); - virtual void flush(void); + virtual int available(void) override; + virtual int read(void) override; + virtual int peek(void) override; + virtual void flush(void) override; void onReceive(void(*)(int)); void onRequest(void(*)(void)); @@ -73,17 +75,16 @@ class TwoWire : public HardwareI2C { inline size_t write(int n) { return write((uint8_t)n); } using Print::write; -private: - // Verifies the passed in pin can be used by this I2C device - bool sdaAllowed(pin_size_t pin); - bool sclAllowed(pin_size_t pin); + // IRQ callback + void onIRQ(); +private: i2c_inst_t *_i2c; pin_size_t _sda; pin_size_t _scl; int _clkHz; - bool _begun; + bool _running; bool _slave; uint8_t _addr; bool _txBegun; @@ -96,6 +97,8 @@ class TwoWire : public HardwareI2C { void (*_onRequestCallback)(void); void (*_onReceiveCallback)(int); + bool _slaveStartDet = false; + // TWI clock frequency static const uint32_t TWI_CLOCK = 100000; }; diff --git a/libraries/Wire/examples/TalkingToMyself/TalkingToMyself.ino b/libraries/Wire/examples/TalkingToMyself/TalkingToMyself.ino new file mode 100644 index 000000000..e5cdb969b --- /dev/null +++ b/libraries/Wire/examples/TalkingToMyself/TalkingToMyself.ino @@ -0,0 +1,64 @@ +// Simple I2C master and slave demo - Earle F. Philhower, III +// Released into the public domain +// +// Using both onboard I2C interfaces, have one master and one slave +// and send data both ways between them +// +// To run, connect GPIO0 to GPIO2, GPIO1 to GPIO3 on a single Pico + +#include + +void setup() { + Serial.begin(115200); + delay(5000); + Wire.begin(); + Wire1.begin(0x30); + Wire1.onReceive(recv); + Wire1.onRequest(req); +} + +static char buff[100]; +void loop() { + static int p; + char b[90]; + + // Write a value over I2C to the slave + Serial.println("Sending..."); + Wire.beginTransmission(0x30); + sprintf(b, "pass %d", p++); + Wire.write(b, strlen(b)); + Wire.endTransmission(); + + // Ensure the slave processing is done and print it out + delay(1000); + Serial.printf("buff: '%s'\r\n", buff); + + // Read from the slave and print out + Wire.requestFrom(0x30, 6); + Serial.print("\nrecv: '"); + while(Wire.available()) { + Serial.print((char)Wire.read()); + } + Serial.println("'"); + delay(1000); +} + +// These are called in an **INTERRUPT CONTEXT** which means NO serial port +// access (i.e. Serial.print is illegal) and no memory allocations, etc. + +// Called when the I2C slave gets written to +void recv(int len) { + int i; + // Just stuff the sent bytes into a global the main routine can pick up and use + for (i=0; i $outdir/platform.txt @@ -140,21 +142,25 @@ fi cat $srcdir/package/package_pico_index.template.json | \ jq "$jq_arg" > package_rp2040_index.json -exit +#exit -# Use Github API token, if available -curl_gh_token_arg=() -if [ ! -z "$CI_GITHUB_API_KEY" ]; then - curl_gh_token_arg=(-H "Authorization: token $CI_GITHUB_API_KEY") +if [ -z "prev_any_release" ]; then + # Use Github API token, if available + curl_gh_token_arg=() + if [ ! -z "$CI_GITHUB_API_KEY" ]; then + curl_gh_token_arg=(-H "Authorization: token $CI_GITHUB_API_KEY") + fi + # Get previous release name + curl --silent "${curl_gh_token_arg[@]}" https://api.github.com/repos/earlephilhower/arduino-pico/releases > releases.json + # Previous final release (prerelase == false) + prev_release=$(jq -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' releases.json) + # Previous release (possibly a pre-release) + prev_any_release=$(jq -r '. | map(select(.draft == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' releases.json) + # Previous pre-release + prev_pre_release=$(jq -r '. | map(select(.draft == false and .prerelease == true)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' releases.json) +else + prev_any_release=$prev_release fi -# Get previous release name -curl --silent "${curl_gh_token_arg[@]}" https://api.github.com/repos/earlephilhower/arduino-pico/releases > releases.json -# Previous final release (prerelase == false) -prev_release=$(jq -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' releases.json) -# Previous release (possibly a pre-release) -prev_any_release=$(jq -r '. | map(select(.draft == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' releases.json) -# Previous pre-release -prev_pre_release=$(jq -r '. | map(select(.draft == false and .prerelease == true)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name' releases.json) echo "Previous release: $prev_release" echo "Previous (pre-?)release: $prev_any_release" @@ -183,6 +189,8 @@ for json in ${MOREJSONPACKAGES}; do fi done +mv tmp $new_json + # Verify the JSON file can be read, fail if it's not OK set -e cat $new_json | jq empty diff --git a/package/merge_packages.py b/package/merge_packages.py new file mode 100755 index 000000000..1e0b1fb27 --- /dev/null +++ b/package/merge_packages.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python3 +# This script merges two Arduino Board Manager package json files. +# Usage: +# python merge_packages.py package_esp8266com_index.json version/new/package_esp8266com_index.json +# Written by Ivan Grokhotkov, 2015 +# +from __future__ import print_function +import json +import sys + +def load_package(filename): + pkg = json.load(open(filename))['packages'][0] + print("Loaded package {0} from {1}".format(pkg['name'], filename), file=sys.stderr) + print("{0} platform(s), {1} tools".format(len(pkg['platforms']), len(pkg['tools'])), file=sys.stderr) + return pkg + +def merge_objects(versions, obj): + for o in obj: + name = o['name'].encode('ascii') + ver = o['version'].encode('ascii') + if not name in versions: + print("found new object, {0}".format(name), file=sys.stderr) + versions[name] = {} + if not ver in versions[name]: + print("found new version {0} for object {1}".format(ver, name), file=sys.stderr) + versions[name][ver] = o + return versions + + +def main(args): + if len(args) < 3: + print("Usage: {0} ".format(args[0]), file=sys.stderr) + return 1 + + tools = {} + platforms = {} + pkg1 = load_package(args[1]) + tools = merge_objects(tools, pkg1['tools']); + platforms = merge_objects(platforms, pkg1['platforms']); + pkg2 = load_package(args[2]) + tools = merge_objects(tools, pkg2['tools']); + platforms = merge_objects(platforms, pkg2['platforms']); + + pkg1['tools'] = [] + pkg1['platforms'] = [] + + for name in tools: + for version in tools[name]: + print("Adding tool {0}-{1}".format(name, version), file=sys.stderr) + pkg1['tools'].append(tools[name][version]) + + for name in platforms: + for version in platforms[name]: + print("Adding platform {0}-{1}".format(name, version), file=sys.stderr) + pkg1['platforms'].append(platforms[name][version]) + + json.dump({'packages':[pkg1]}, sys.stdout, indent=2) + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff --git a/package/package_pico_index.template.json b/package/package_pico_index.template.json index 2f29f895f..62ea16af2 100644 --- a/package/package_pico_index.template.json +++ b/package/package_pico_index.template.json @@ -19,33 +19,44 @@ "boards": [ { "name": "Raspberry Pi Pico" + }, + { + "name": "Adafruit Feather RP2040" + }, + { + "name": "Generic RP2040 Module" } ], "toolsDependencies": [ { "packager": "rp2040", - "version": "1.0.1-base-3a57aed", + "version": "1.1.0-a-81a1771", "name": "pqt-gcc" }, { "packager": "rp2040", - "version": "1.0.1-base-3a57aed", + "version": "1.1.0-a-81a1771", "name": "pqt-mklittlefs" }, { "packager": "rp2040", - "version": "1.0.1-base-3a57aed", + "version": "1.1.0-a-81a1771", "name": "pqt-elf2uf2" }, { "packager": "rp2040", - "version": "1.0.1-base-3a57aed", + "version": "1.1.0-a-81a1771", "name": "pqt-pioasm" }, { "packager": "rp2040", "version": "1.0.1-base-3a57aed", "name": "pqt-python3" + }, + { + "packager": "rp2040", + "version": "1.1.0-a-81a1771", + "name": "pqt-openocd" } ], "help": { @@ -54,10 +65,72 @@ } ], "tools": [ + { + "version": "1.1.0-a-81a1771", + "name": "pqt-openocd", + "systems": [ + { + "host": "aarch64-linux-gnu", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/aarch64-linux-gnu.openocd-d58c2ef5e.210328.tar.gz", + "archiveFileName": "aarch64-linux-gnu.openocd-d58c2ef5e.210328.tar.gz", + "checksum": "SHA-256:5064727a074c8bc8dff988e82bc2460c5f5610a04ec0a61ba233bdabe0499a24", + "size": "" + }, + { + "host": "arm-linux-gnueabihf", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/arm-linux-gnueabihf.openocd-d58c2ef5e.210328.tar.gz", + "archiveFileName": "arm-linux-gnueabihf.openocd-d58c2ef5e.210328.tar.gz", + "checksum": "SHA-256:12e61ebe727cb188fab25af174f0696ef86d629701f03f189965a725bd51275b", + "size": "" + }, + { + "host": "i686-pc-linux-gnu", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-linux-gnu.openocd-d58c2ef5e.210328.tar.gz", + "archiveFileName": "i686-linux-gnu.openocd-d58c2ef5e.210328.tar.gz", + "checksum": "SHA-256:eaa89ac30556aaed5cd09fff4f46435f5a79c58d2060069db7606f9ecc9529ef", + "size": "" + }, + { + "host": "i686-mingw32", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-w64-mingw32.openocd-d58c2ef5e.210328.zip", + "archiveFileName": "i686-w64-mingw32.openocd-d58c2ef5e.210328.zip", + "checksum": "SHA-256:65b8c96b94f1cc3ff13eb853138efb3a465150fb02d07c792f8b235d43b05061", + "size": "" + }, + { + "host": "x86_64-apple-darwin", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-apple-darwin14.openocd-d58c2ef5e.210328.tar.gz", + "archiveFileName": "x86_64-apple-darwin14.openocd-d58c2ef5e.210328.tar.gz", + "checksum": "SHA-256:b8a759d7ac20643641285b0b05473b853e50739dd254b2294f5d1802ff0e15ca", + "size": "" + }, + { + "host": "x86_64-pc-linux-gnu", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-linux-gnu.openocd-d58c2ef5e.210328.tar.gz", + "archiveFileName": "x86_64-linux-gnu.openocd-d58c2ef5e.210328.tar.gz", + "checksum": "SHA-256:9ff31fc92d6f86503d1750d009fec7e7c8c185c7956b140c4b78ee029d31c19c", + "size": "" + }, + { + "host": "x86_64-mingw32", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-w64-mingw32.openocd-d58c2ef5e.210328.zip", + "archiveFileName": "x86_64-w64-mingw32.openocd-d58c2ef5e.210328.zip", + "checksum": "SHA-256:8f1ddd64b0a6f83f94437d509bb28cdd45ad481bb161c170d57a6736f75087ec", + "size": "" + } + ] + }, { "version": "1.0.1-base-3a57aed", "name": "pqt-python3", "systems": [ + { + "host": "arm-linux-gnueabihf", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/python3-via-env.tar.gz", + "archiveFileName": "python3-via-env.tar.gz", + "checksum": "SHA-256:c9237bfe0f62842d7187a39495baa4a7e3ab8b87c0b433614294b023cf0bc0f3", + "size": "292" + }, { "host": "x86_64-mingw32", "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/python3-3.7.2.post1-embed-win32v2a.zip", @@ -110,208 +183,222 @@ ] }, { - "version": "1.0.1-base-3a57aed", + "version": "1.1.0-a-81a1771", "name": "pqt-gcc", "systems": [ { "host": "aarch64-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/aarch64-linux-gnu.arm-none-eabi-3a57aed.210313.tar.gz", - "archiveFileName": "aarch64-linux-gnu.arm-none-eabi-3a57aed.210313.tar.gz", - "checksum": "SHA-256:dc2114a35b06275b75459ecb8d5cb25a7d2df8d7e713eafa557becca78a5f40a", - "size": "101453053" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/aarch64-linux-gnu.arm-none-eabi-81a1771.210328.tar.gz", + "archiveFileName": "aarch64-linux-gnu.arm-none-eabi-81a1771.210328.tar.gz", + "checksum": "SHA-256:04eaa4a1c0596b1a47252150323af0a4def791cb9da20634872becbdbdfef979", + "size": "101469960" + }, + { + "host": "arm-linux-gnueabihf", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/arm-linux-gnueabihf.arm-none-eabi-81a1771.210328.tar.gz", + "archiveFileName": "arm-linux-gnueabihf.arm-none-eabi-81a1771.210328.tar.gz", + "checksum": "SHA-256:43e739a2219ef9e9d16d1c81d4252c22a7392315325046d450542a3df6b35b96", + "size": "94164344" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-linux-gnu.arm-none-eabi-3a57aed.210313.tar.gz", - "archiveFileName": "i686-linux-gnu.arm-none-eabi-3a57aed.210313.tar.gz", - "checksum": "SHA-256:4fe2689e260fb8bc48fa17132d7daa6ff168d3b95940747f6539fd5f0181ea4c", - "size": "104235638" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-linux-gnu.arm-none-eabi-81a1771.210328.tar.gz", + "archiveFileName": "i686-linux-gnu.arm-none-eabi-81a1771.210328.tar.gz", + "checksum": "SHA-256:b5961edde0d58b7dbc5c7b1c8fbf9d461fe2a7204f5282f6b5336a5d435efd3b", + "size": "104228428" }, { "host": "i686-mingw32", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-w64-mingw32.arm-none-eabi-3a57aed.210313.zip", - "archiveFileName": "i686-w64-mingw32.arm-none-eabi-3a57aed.210313.zip", - "checksum": "SHA-256:4674be35ae64dc70e0bb71dfd8b7fe1a3fc391b2a3cdb4f1c09b3a20b33d0f6e", - "size": "103801267" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-w64-mingw32.arm-none-eabi-81a1771.210328.zip", + "archiveFileName": "i686-w64-mingw32.arm-none-eabi-81a1771.210328.zip", + "checksum": "SHA-256:347fdc73b9f99e529c70598f9bf2ebc85adad098a24206cf89f8297a40e44d60", + "size": "103803990" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-apple-darwin14.arm-none-eabi-3a57aed.210313.tar.gz", - "archiveFileName": "x86_64-apple-darwin14.arm-none-eabi-3a57aed.210313.tar.gz", - "checksum": "SHA-256:64fe0701158de39afd6dced8e29f6cee41549a07d60c62f751a5052e67d1d7bf", - "size": "105658586" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-apple-darwin14.arm-none-eabi-81a1771.210328.tar.gz", + "archiveFileName": "x86_64-apple-darwin14.arm-none-eabi-81a1771.210328.tar.gz", + "checksum": "SHA-256:c035b48e0a42b90c9a356b43813671597a6c0f1cab4fb97a0dfcb2bbc7eb5390", + "size": "105653466" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-linux-gnu.arm-none-eabi-3a57aed.210313.tar.gz", - "archiveFileName": "x86_64-linux-gnu.arm-none-eabi-3a57aed.210313.tar.gz", - "checksum": "SHA-256:f7c76cd1844cc81baa302ffd7197485de51bb6f7d250612950730abefdf3b385", - "size": "106137013" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-linux-gnu.arm-none-eabi-81a1771.210328.tar.gz", + "archiveFileName": "x86_64-linux-gnu.arm-none-eabi-81a1771.210328.tar.gz", + "checksum": "SHA-256:b13ea47f3c62b65eda3acd40f43a392e8799696d821bc5c114e60950ab125bc0", + "size": "106132177" }, { "host": "x86_64-mingw32", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-w64-mingw32.arm-none-eabi-3a57aed.210313.zip", - "archiveFileName": "x86_64-w64-mingw32.arm-none-eabi-3a57aed.210313.zip", - "checksum": "SHA-256:706e67177c88ce4ad01350b18ae5739f989c001e5c9b891139a2fc1148a8ff07", - "size": "108656841" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-w64-mingw32.arm-none-eabi-81a1771.210328.zip", + "archiveFileName": "x86_64-w64-mingw32.arm-none-eabi-81a1771.210328.zip", + "checksum": "SHA-256:06b19d7f9e9e2c1c3fc87d85af144b02591e3c5643c67521ff9807cdb5f6ecc7", + "size": "108657552" } ] }, { - "version": "1.0.1-base-3a57aed", + "version": "1.1.0-a-81a1771", "name": "pqt-elf2uf2", "systems": [ { "host": "aarch64-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/aarch64-linux-gnu.elf2uf2-0f3b795.210313.tar.gz", - "archiveFileName": "aarch64-linux-gnu.elf2uf2-0f3b795.210313.tar.gz", - "checksum": "SHA-256:9f88e2842af0372073f612f6080dbd00c0991fa66f970177eeaa9caa633466b6", - "size": "24865" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/aarch64-linux-gnu.elf2uf2-0f3b795.210328.tar.gz", + "archiveFileName": "aarch64-linux-gnu.elf2uf2-0f3b795.210328.tar.gz", + "checksum": "SHA-256:5df8c7c132bc0f469c6610162d3c9836530acf4ace9bf4c3a849c80218f1855d", + "size": "104572" + }, + { + "host": "arm-linux-gnueabihf", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/arm-linux-gnueabihf.elf2uf2-0f3b795.210328.tar.gz", + "archiveFileName": "arm-linux-gnueabihf.elf2uf2-0f3b795.210328.tar.gz", + "checksum": "SHA-256:dc311e18fac1e474804c044d194224267a729a16b34940c2e1ff23ab03207d98", + "size": "80513" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-linux-gnu.elf2uf2-0f3b795.210313.tar.gz", - "archiveFileName": "i686-linux-gnu.elf2uf2-0f3b795.210313.tar.gz", - "checksum": "SHA-256:7fa194d699656e44441d8e4ab70fd5efaf1fce536ff2f3fa802e1ad3da1fd001", - "size": "25708" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-linux-gnu.elf2uf2-0f3b795.210328.tar.gz", + "archiveFileName": "i686-linux-gnu.elf2uf2-0f3b795.210328.tar.gz", + "checksum": "SHA-256:c39f24206e69230166fa15154b76d9553e732815cea59ee00b822b5acf2257db", + "size": "110686" }, { "host": "i686-mingw32", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-w64-mingw32.elf2uf2-0f3b795.210316.zip", - "archiveFileName": "i686-w64-mingw32.elf2uf2-0f3b795.210316.zip", - "checksum": "SHA-256:0b4cd2eb4c7a8b98c68cd9b499f601ab9e870d29aa9297887ac7deb8740ad536", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-w64-mingw32.elf2uf2-0f3b795.210328.zip", + "archiveFileName": "i686-w64-mingw32.elf2uf2-0f3b795.210328.zip", + "checksum": "SHA-256:d239f7b5d7d71e646bb7cd3c59ddef593b3e564968e262b9290353a0d8102d7d", "size": "247162" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-apple-darwin14.elf2uf2-0f3b795.210313.tar.gz", - "archiveFileName": "x86_64-apple-darwin14.elf2uf2-0f3b795.210313.tar.gz", - "checksum": "SHA-256:dd5a3f240eed1c9331e7b9a94da441664488ed6acd15a1291a928db043a0dc71", - "size": "106607" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-apple-darwin14.elf2uf2-0f3b795.210328.tar.gz", + "archiveFileName": "x86_64-apple-darwin14.elf2uf2-0f3b795.210328.tar.gz", + "checksum": "SHA-256:3c776891300a3626ab4704808c61a15b653d58ff4f02398b492c12aed268f6aa", + "size": "106610" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-linux-gnu.elf2uf2-0f3b795.210313.tar.gz", - "archiveFileName": "x86_64-linux-gnu.elf2uf2-0f3b795.210313.tar.gz", - "checksum": "SHA-256:f97c695cdf8152700521666cf8822f24aca879a28995ea4ea9467cb02a740067", - "size": "23963" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-linux-gnu.elf2uf2-0f3b795.210328.tar.gz", + "archiveFileName": "x86_64-linux-gnu.elf2uf2-0f3b795.210328.tar.gz", + "checksum": "SHA-256:90c57b7cc68323e84e4cdc7d6da44c0aeb11a1c102c51d03fb42179d6162d3f3", + "size": "101265" }, { "host": "x86_64-mingw32", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-w64-mingw32.elf2uf2-0f3b795.210316.zip", - "archiveFileName": "i686-w64-mingw32.elf2uf2-0f3b795.210316.zip", - "checksum": "SHA-256:0b4cd2eb4c7a8b98c68cd9b499f601ab9e870d29aa9297887ac7deb8740ad536", - "size": "247162" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-w64-mingw32.elf2uf2-0f3b795.210328.zip", + "archiveFileName": "x86_64-w64-mingw32.elf2uf2-0f3b795.210328.zip", + "checksum": "SHA-256:a9afa2f04eb5510c8f39ea91d90b63a0dfe0b8037c6bca4d65de8905ca87175f", + "size": "275914" } ] }, { - "version": "1.0.1-base-3a57aed", + "version": "1.1.0-a-81a1771", "name": "pqt-pioasm", "systems": [ { "host": "aarch64-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/aarch64-linux-gnu.pioasm-0f3b795.210313.tar.gz", - "archiveFileName": "aarch64-linux-gnu.pioasm-0f3b795.210313.tar.gz", - "checksum": "SHA-256:8906187126f4e1020fccb003469ec791b1ca503954562158053fa1ee5caec654", - "size": "159824" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/aarch64-linux-gnu.pioasm-0f3b795.210328.tar.gz", + "archiveFileName": "aarch64-linux-gnu.pioasm-0f3b795.210328.tar.gz", + "checksum": "SHA-256:28cd0813a46d81becb6b743ca6c7a53da0ed15f4da61ccee422f66eeb427912b", + "size": "619033" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/arm-linux-gnueabihf.pioasm-0f3b795.210313.tar.gz", - "archiveFileName": "arm-linux-gnueabihf.pioasm-0f3b795.210313.tar.gz", - "checksum": "SHA-256:c5db2035e5cf22a7bef2f183100d938d1395108a1785423254e5ab458fd52521", - "size": "142636" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/arm-linux-gnueabihf.pioasm-0f3b795.210328.tar.gz", + "archiveFileName": "arm-linux-gnueabihf.pioasm-0f3b795.210328.tar.gz", + "checksum": "SHA-256:d1c8f3b208aa00e801dad594c9d0425c9615b1531fb3f86adb95a6188868462c", + "size": "536769" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-linux-gnu.pioasm-0f3b795.210313.tar.gz", - "archiveFileName": "i686-linux-gnu.pioasm-0f3b795.210313.tar.gz", - "checksum": "SHA-256:c077562da5bc6e06631852ce4cc360bcd1df534c5351f06d2cc997e2cf9f731d", - "size": "172777" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-linux-gnu.pioasm-0f3b795.210328.tar.gz", + "archiveFileName": "i686-linux-gnu.pioasm-0f3b795.210328.tar.gz", + "checksum": "SHA-256:d09a70558acabf343ae04c783eac622e9bd1a6cfb74f42ebee03c0cfde5093c7", + "size": "658587" }, { "host": "i686-mingw32", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-w64-mingw32.pioasm-0f3b795.210313.zip", - "archiveFileName": "i686-w64-mingw32.pioasm-0f3b795.210313.zip", - "checksum": "SHA-256:127dcde2706fe7730dc1e67a69d9ad84f670f62358abb5479e54e0397bdaed4a", - "size": "309084" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-w64-mingw32.pioasm-0f3b795.210328.zip", + "archiveFileName": "i686-w64-mingw32.pioasm-0f3b795.210328.zip", + "checksum": "SHA-256:c2ab0c8f3d54886838abb0c40910113e2e1e891068b205ec23944eecd0ce8037", + "size": "756780" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-apple-darwin14.pioasm-0f3b795.210313.tar.gz", - "archiveFileName": "x86_64-apple-darwin14.pioasm-0f3b795.210313.tar.gz", - "checksum": "SHA-256:faf394d4d1a3722f062f1ecc32da8a54c1025764494ba9c548d2ad230e21f562", - "size": "590059" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-apple-darwin14.pioasm-0f3b795.210328.tar.gz", + "archiveFileName": "x86_64-apple-darwin14.pioasm-0f3b795.210328.tar.gz", + "checksum": "SHA-256:f48d729582eda8d95c16d2f5fd76ba452a6dd2ae3a47ea9dace01a130e4fb897", + "size": "609240" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-linux-gnu.pioasm-0f3b795.210313.tar.gz", - "archiveFileName": "x86_64-linux-gnu.pioasm-0f3b795.210313.tar.gz", - "checksum": "SHA-256:9d10d92eb71c9661515a3988e5099fb7a83ce69aebbd3723d2ec9cc328106664", - "size": "159488" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-linux-gnu.pioasm-0f3b795.210328.tar.gz", + "archiveFileName": "x86_64-linux-gnu.pioasm-0f3b795.210328.tar.gz", + "checksum": "SHA-256:ca089e67effb47dec2a9acdf1490052d096335a8b8ffa46eaa33c205eec87b7b", + "size": "605194" }, { "host": "x86_64-mingw32", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-w64-mingw32.pioasm-0f3b795.210313.zip", - "archiveFileName": "x86_64-w64-mingw32.pioasm-0f3b795.210313.zip", - "checksum": "SHA-256:cbf9a5335419268ed6bf2338dcc3d426aa24f639923a4cd7dd83f6ead1b773cf", - "size": "380973" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-w64-mingw32.pioasm-0f3b795.210328.zip", + "archiveFileName": "x86_64-w64-mingw32.pioasm-0f3b795.210328.zip", + "checksum": "SHA-256:f02509d1a75b68f14a3c3089029a0f16d185b07af598a4786b3bb6b357b88fa1", + "size": "886179" } ] }, { - "version": "1.0.1-base-3a57aed", + "version": "1.1.0-a-81a1771", "name": "pqt-mklittlefs", "systems": [ { "host": "aarch64-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/aarch64-linux-gnu.mklittlefs-6b5c62d.210313.tar.gz", - "archiveFileName": "aarch64-linux-gnu.mklittlefs-6b5c62d.210313.tar.gz", - "checksum": "SHA-256:c31df4ede9e2137c96ff532b3cb8af1a47304258837f69b1bd717160d44ef3a9", - "size": "44794" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/aarch64-linux-gnu.mklittlefs-6b5c62d.210328.tar.gz", + "archiveFileName": "aarch64-linux-gnu.mklittlefs-6b5c62d.210328.tar.gz", + "checksum": "SHA-256:e8a77602a78ff51ed1588e0aef23c75f54dc3b8415a489ae700c90306da81701", + "size": "44791" }, { "host": "arm-linux-gnueabihf", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/arm-linux-gnueabihf.mklittlefs-6b5c62d.210313.tar.gz", - "archiveFileName": "arm-linux-gnueabihf.mklittlefs-6b5c62d.210313.tar.gz", - "checksum": "SHA-256:2572e4e024bc97995aadf3512dad6843ee9c5c6a66b171963b36563f7632041b", - "size": "37335" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/arm-linux-gnueabihf.mklittlefs-6b5c62d.210328.tar.gz", + "archiveFileName": "arm-linux-gnueabihf.mklittlefs-6b5c62d.210328.tar.gz", + "checksum": "SHA-256:6faa9ec2dfc9c6ef58df2e0fd0a990be923ce87a1f36f3e0766af2168b095d50", + "size": "38250" }, { "host": "i686-pc-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-linux-gnu.mklittlefs-6b5c62d.210313.tar.gz", - "archiveFileName": "i686-linux-gnu.mklittlefs-6b5c62d.210313.tar.gz", - "checksum": "SHA-256:141a45d6b1ad97bc220daefd8d1876b43cc509e7bc2a4dccf2f99483d9a88c78", - "size": "48245" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-linux-gnu.mklittlefs-6b5c62d.210328.tar.gz", + "archiveFileName": "i686-linux-gnu.mklittlefs-6b5c62d.210328.tar.gz", + "checksum": "SHA-256:6aa70b5953e76cc9561b77a8092b14a33c9850c42dd9b306a052fc2d056a89a8", + "size": "48237" }, { "host": "i686-mingw32", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/i686-w64-mingw32.mklittlefs-6b5c62d.210313.zip", - "archiveFileName": "i686-w64-mingw32.mklittlefs-6b5c62d.210313.zip", - "checksum": "SHA-256:d30b9b34cce408df396dcd77cebd0fe876f950a13cefcb21f724412089c4b1c4", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/i686-w64-mingw32.mklittlefs-6b5c62d.210328.zip", + "archiveFileName": "i686-w64-mingw32.mklittlefs-6b5c62d.210328.zip", + "checksum": "SHA-256:34e0a84d0f562e6f9bfd91090f9064164062f7c68b4dbd65d7f154987f7940e3", "size": "332804" }, { "host": "x86_64-apple-darwin", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-apple-darwin14.mklittlefs-6b5c62d.210313.tar.gz", - "archiveFileName": "x86_64-apple-darwin14.mklittlefs-6b5c62d.210313.tar.gz", - "checksum": "SHA-256:3430d401f0f1ec188e18fb6380f17d6ee07aa11a11509eb85dadfda429d1bbee", - "size": "362809" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-apple-darwin14.mklittlefs-6b5c62d.210328.tar.gz", + "archiveFileName": "x86_64-apple-darwin14.mklittlefs-6b5c62d.210328.tar.gz", + "checksum": "SHA-256:5289f7cde14a5b65a572ddb3b2b0e24f2ea692365787438586f60929750dc395", + "size": "362804" }, { "host": "x86_64-pc-linux-gnu", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-linux-gnu.mklittlefs-6b5c62d.210313.tar.gz", - "archiveFileName": "x86_64-linux-gnu.mklittlefs-6b5c62d.210313.tar.gz", - "checksum": "SHA-256:fa762ca823cf31862a28cfff2646c8c9241a8e29b989619f3ee25ac9a4e8ce8a", + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-linux-gnu.mklittlefs-6b5c62d.210328.tar.gz", + "archiveFileName": "x86_64-linux-gnu.mklittlefs-6b5c62d.210328.tar.gz", + "checksum": "SHA-256:07331f6a171010790986bbd6e98cef028dd9f95733226ebab68096e28b3ef8ef", "size": "46917" }, { "host": "x86_64-mingw32", - "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.0.1-base/x86_64-w64-mingw32.mklittlefs-6b5c62d.210313.zip", - "archiveFileName": "x86_64-w64-mingw32.mklittlefs-6b5c62d.210313.zip", - "checksum": "SHA-256:90c99760b47894ef4f7bfacacd2586c29245ebffb89af46d47cda7de1a5110a5", - "size": "345249" + "url": "https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.1.0-a/x86_64-w64-mingw32.mklittlefs-6b5c62d.210328.zip", + "archiveFileName": "x86_64-w64-mingw32.mklittlefs-6b5c62d.210328.zip", + "checksum": "SHA-256:17889e9ab6d199baed2c1532926c8508310524f9ba6b1db0816be5ee5d39a2f6", + "size": "345250" } ] } diff --git a/pico-sdk b/pico-sdk index 2d5789eca..fc10a97c3 160000 --- a/pico-sdk +++ b/pico-sdk @@ -1 +1 @@ -Subproject commit 2d5789eca89658a7f0a01e2d6010c0f254605d72 +Subproject commit fc10a97c386f65c1a44c68684fe52a56aaf50df0 diff --git a/pico-sdk-lib/CMakeLists.txt b/pico-sdk-lib/CMakeLists.txt index 0ed366b23..e5bccaf45 100644 --- a/pico-sdk-lib/CMakeLists.txt +++ b/pico-sdk-lib/CMakeLists.txt @@ -13,55 +13,56 @@ pico_sdk_init() add_library(pico STATIC) target_compile_definitions(pico PUBLIC - PICO_PRINTF_ALWAYS_INCLUDED=1 ) + PICO_PRINTF_ALWAYS_INCLUDED=1 +) target_link_libraries(pico boot_stage2 -hardware_adc -hardware_base -hardware_claim -hardware_clocks -hardware_divider -hardware_dma -hardware_flash -hardware_gpio -hardware_i2c -hardware_interp -hardware_irq -hardware_pio -hardware_pll -hardware_pwm -hardware_resets -hardware_rtc -hardware_spi -hardware_sync -hardware_timer -hardware_uart -hardware_vreg -hardware_watchdog -hardware_xosc -pico_bit_ops -pico_bootrom -pico_bootsel_via_double_reset -pico_cxx_options -pico_divider -pico_double -pico_fix -pico_float -pico_int64_ops -pico_malloc -pico_mem_ops -pico_multicore -pico_platform -pico_runtime -pico_standard_link -pico_stdio -pico_stdio_usb -pico_stdlib -pico_unique_id -tinyusb + hardware_adc + hardware_base + hardware_claim + hardware_clocks + hardware_divider + hardware_dma + hardware_flash + hardware_gpio + hardware_i2c + hardware_interp + hardware_irq + hardware_pio + hardware_pll + hardware_pwm + hardware_resets + hardware_rtc + hardware_spi + hardware_sync + hardware_timer + hardware_uart + hardware_vreg + hardware_watchdog + hardware_xosc + pico_bit_ops + pico_bootrom + pico_bootsel_via_double_reset + pico_cxx_options + pico_divider + pico_double + pico_fix + pico_float + pico_int64_ops + pico_malloc + pico_mem_ops + pico_multicore + pico_platform + pico_runtime + pico_standard_link + pico_stdio_usb + pico_stdlib + pico_unique_id + tinyusb ) + add_custom_command(TARGET pico PRE_BUILD COMMAND ../../system/arm-none-eabi/bin/arm-none-eabi-gcc -g -c ../../assembly/crt0.S -I ../../pico-sdk/src/rp2040/hardware_regs/include -I ../../pico-sdk/src/common/pico_binary_info/include/ ) @@ -69,6 +70,5 @@ add_custom_command(TARGET pico PRE_BUILD add_custom_command(TARGET pico POST_BUILD COMMAND ar d libpico.a crt0.S.obj COMMAND ar r libpico.a crt0.o - ) -# COMMAND ar dv libpico.a stdio_uart.c.obj stdio.c.obj printf.c.obj - + COMMAND ar d libpico.a stdio.c.obj stdio_usb.c.obj stdio_usb_descriptors.c.obj +) diff --git a/pico-sdk-lib/build.sh b/pico-sdk-lib/build.sh index e3783449b..5ece094c3 100755 --- a/pico-sdk-lib/build.sh +++ b/pico-sdk-lib/build.sh @@ -5,4 +5,4 @@ cd build PICO_SDK_PATH=../../pico-sdk/ PATH="$(cd ../../system/arm-none-eabi/bin; pwd):$PATH" cmake .. make cp libpico.a ../../lib/. - +cp generated/pico_base/pico/version.h ../../pico_base/pico/. diff --git a/pico_base/pico/version.h b/pico_base/pico/version.h index cf2df6871..c32561577 100644 --- a/pico_base/pico/version.h +++ b/pico_base/pico/version.h @@ -12,8 +12,8 @@ #define _PICO_VERSION_H #define PICO_SDK_VERSION_MAJOR 1 -#define PICO_SDK_VERSION_MINOR 0 +#define PICO_SDK_VERSION_MINOR 1 #define PICO_SDK_VERSION_REVISION 0 -#define PICO_SDK_VERSION_STRING "1.0.0" +#define PICO_SDK_VERSION_STRING "1.1.0" #endif diff --git a/platform.txt b/platform.txt index 7923ac983..0d2ef036a 100644 --- a/platform.txt +++ b/platform.txt @@ -1,4 +1,6 @@ -# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# Copyright (c) 2021 Earle F. Philhower, III +# +# Raspberry Pi RP2040 Core platform file # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -14,13 +16,11 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# Arduino SAMD Core and platform. -# # For more info: # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification -name=Rasperry Pi RP2040 Boards -version=1.0.0 +name=Raspberry Pi RP2040 Boards +version=0.9.9 runtime.tools.pqt-gcc.path={runtime.platform.path}/system/arm-none-eabi runtime.tools.pqt-python3.path={runtime.platform.path}/system/python3 runtime.tools.pqt-mklittlefs.path={runtime.platform.path}/system/mklittlefs @@ -39,14 +39,14 @@ compiler.warning_flags.more=-Wall compiler.warning_flags.all=-Wall -Wextra compiler.defines={build.led} -compiler.includes=-I{runtime.platform.path}/pico_base/ -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_unique_id/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_platform/include/ -I{runtime.platform.path}/pico-sdk/src/common/pico_base/include/ -I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/ -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_timer/include/ -I{runtime.platform.path}/pico-sdk/src/common/pico_stdlib/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_gpio/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_i2c/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_flash/include -I{runtime.platform.path}/pico-sdk/src/common/pico_base/include -I{runtime.platform.path}/pico-examples/build/generated/pico_base -I{runtime.platform.path}/pico-sdk/src/boards/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_platform/include -I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_base/include -I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_structs/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_claim/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_sync/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_uart/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_divider/include -I{runtime.platform.path}/pico-sdk/src/common/pico_time/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_timer/include -I{runtime.platform.path}/pico-sdk/src/common/pico_sync/include -I{runtime.platform.path}/pico-sdk/src/common/pico_util/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_runtime/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_clocks/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_resets/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_watchdog/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_xosc/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_pll/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_vreg/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_irq/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_printf/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_bootrom/include -I{runtime.platform.path}/pico-sdk/src/common/pico_bit_ops/include -I{runtime.platform.path}/pico-sdk/src/common/pico_divider/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_double/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_int64_ops/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_float/include -I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_pio/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_stdio/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_stdio_uart/include -I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/ -I{runtime.platform.path}/pico-sdk/lib/tinyusb/src/ -I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_stdio_usb/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_spi/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_pwm/include -I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_adc/include +compiler.includes="-I{runtime.platform.path}/pico_base/" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_unique_id/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_platform/include/" "-I{runtime.platform.path}/pico-sdk/src/common/pico_base/include/" "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_timer/include/" "-I{runtime.platform.path}/pico-sdk/src/common/pico_stdlib/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_gpio/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_i2c/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_flash/include" "-I{runtime.platform.path}/pico-sdk/src/common/pico_base/include" "-I{runtime.platform.path}/pico-examples/build/generated/pico_base" "-I{runtime.platform.path}/pico-sdk/src/boards/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_platform/include" "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_base/include" "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_structs/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_claim/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_sync/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_uart/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_divider/include" "-I{runtime.platform.path}/pico-sdk/src/common/pico_time/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_timer/include" "-I{runtime.platform.path}/pico-sdk/src/common/pico_sync/include" "-I{runtime.platform.path}/pico-sdk/src/common/pico_util/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_runtime/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_clocks/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_resets/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_watchdog/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_xosc/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_pll/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_vreg/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_irq/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_printf/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_bootrom/include" "-I{runtime.platform.path}/pico-sdk/src/common/pico_bit_ops/include" "-I{runtime.platform.path}/pico-sdk/src/common/pico_divider/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_double/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_int64_ops/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_float/include" "-I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_pio/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_stdio/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_stdio_uart/include" "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/" "-I{runtime.platform.path}/pico-sdk/lib/tinyusb/src/" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_stdio_usb/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_spi/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_pwm/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/hardware_adc/include" "-I{runtime.platform.path}/pico-sdk/src/rp2_common/pico_multicore/include" compiler.flags=-Os -march=armv6-m -mcpu=cortex-m0plus -mthumb -ffunction-sections -fdata-sections compiler.wrap=-Wl,--wrap=acos -Wl,--wrap=acosf -Wl,--wrap=acosh -Wl,--wrap=acoshf -Wl,--wrap=__aeabi_cdcmpeq -Wl,--wrap=__aeabi_cdcmple -Wl,--wrap=__aeabi_cdrcmple -Wl,--wrap=__aeabi_cfcmpeq -Wl,--wrap=__aeabi_cfcmple -Wl,--wrap=__aeabi_cfrcmple -Wl,--wrap=__aeabi_d2f -Wl,--wrap=__aeabi_d2iz -Wl,--wrap=__aeabi_d2lz -Wl,--wrap=__aeabi_d2uiz -Wl,--wrap=__aeabi_d2ulz -Wl,--wrap=__aeabi_dadd -Wl,--wrap=__aeabi_dcmpeq -Wl,--wrap=__aeabi_dcmpge -Wl,--wrap=__aeabi_dcmpgt -Wl,--wrap=__aeabi_dcmple -Wl,--wrap=__aeabi_dcmplt -Wl,--wrap=__aeabi_dcmpun -Wl,--wrap=__aeabi_ddiv -Wl,--wrap=__aeabi_dmul -Wl,--wrap=__aeabi_drsub -Wl,--wrap=__aeabi_dsub -Wl,--wrap=__aeabi_f2d -Wl,--wrap=__aeabi_f2iz -Wl,--wrap=__aeabi_f2lz -Wl,--wrap=__aeabi_f2uiz -Wl,--wrap=__aeabi_f2ulz -Wl,--wrap=__aeabi_fadd -Wl,--wrap=__aeabi_fcmpeq -Wl,--wrap=__aeabi_fcmpge -Wl,--wrap=__aeabi_fcmpgt -Wl,--wrap=__aeabi_fcmple -Wl,--wrap=__aeabi_fcmplt -Wl,--wrap=__aeabi_fcmpun -Wl,--wrap=__aeabi_fdiv -Wl,--wrap=__aeabi_fmul -Wl,--wrap=__aeabi_frsub -Wl,--wrap=__aeabi_fsub -Wl,--wrap=__aeabi_i2d -Wl,--wrap=__aeabi_i2f -Wl,--wrap=__aeabi_idiv -Wl,--wrap=__aeabi_idivmod -Wl,--wrap=__aeabi_l2d -Wl,--wrap=__aeabi_l2f -Wl,--wrap=__aeabi_ldivmod -Wl,--wrap=__aeabi_lmul -Wl,--wrap=__aeabi_memcpy -Wl,--wrap=__aeabi_memcpy4 -Wl,--wrap=__aeabi_memcpy8 -Wl,--wrap=__aeabi_memset -Wl,--wrap=__aeabi_memset4 -Wl,--wrap=__aeabi_memset8 -Wl,--wrap=__aeabi_ui2d -Wl,--wrap=__aeabi_ui2f -Wl,--wrap=__aeabi_uidiv -Wl,--wrap=__aeabi_uidivmod -Wl,--wrap=__aeabi_ul2d -Wl,--wrap=__aeabi_ul2f -Wl,--wrap=__aeabi_uldivmod -Wl,--wrap=asin -Wl,--wrap=asinf -Wl,--wrap=asinh -Wl,--wrap=asinhf -Wl,--wrap=atan -Wl,--wrap=atan2 -Wl,--wrap=atan2f -Wl,--wrap=atanf -Wl,--wrap=atanh -Wl,--wrap=atanhf -Wl,--wrap=calloc -Wl,--wrap=cbrt -Wl,--wrap=cbrtf -Wl,--wrap=ceil -Wl,--wrap=ceilf -Wl,--wrap=__clz -Wl,--wrap=__clzdi2 -Wl,--wrap=__clzl -Wl,--wrap=__clzll -Wl,--wrap=__clzsi2 -Wl,--wrap=copysign -Wl,--wrap=copysignf -Wl,--wrap=cos -Wl,--wrap=cosf -Wl,--wrap=cosh -Wl,--wrap=coshf -Wl,--wrap=__ctzdi2 -Wl,--wrap=__ctzsi2 -Wl,--wrap=drem -Wl,--wrap=dremf -Wl,--wrap=exp -Wl,--wrap=exp10 -Wl,--wrap=exp10f -Wl,--wrap=exp2 -Wl,--wrap=exp2f -Wl,--wrap=expf -Wl,--wrap=expm1 -Wl,--wrap=expm1f -Wl,--wrap=floor -Wl,--wrap=floorf -Wl,--wrap=fma -Wl,--wrap=fmaf -Wl,--wrap=fmod -Wl,--wrap=fmodf -Wl,--wrap=free -Wl,--wrap=hypot -Wl,--wrap=hypotf -Wl,--wrap=ldexp -Wl,--wrap=ldexpf -Wl,--wrap=log -Wl,--wrap=log10 -Wl,--wrap=log10f -Wl,--wrap=log1p -Wl,--wrap=log1pf -Wl,--wrap=log2 -Wl,--wrap=log2f -Wl,--wrap=logf -Wl,--wrap=malloc -Wl,--wrap=memcpy -Wl,--wrap=memset -Wl,--wrap=__popcountdi2 -Wl,--wrap=__popcountsi2 -Wl,--wrap=pow -Wl,--wrap=powf -Wl,--wrap=powint -Wl,--wrap=powintf -Wl,--wrap=remainder -Wl,--wrap=remainderf -Wl,--wrap=remquo -Wl,--wrap=remquof -Wl,--wrap=round -Wl,--wrap=roundf -Wl,--wrap=sin -Wl,--wrap=sincos -Wl,--wrap=sincosf -Wl,--wrap=sinf -Wl,--wrap=sinh -Wl,--wrap=sinhf -Wl,--wrap=sqrt -Wl,--wrap=sqrtf -Wl,--wrap=tan -Wl,--wrap=tanf -Wl,--wrap=tanh -Wl,--wrap=tanhf -Wl,--wrap=trunc -Wl,--wrap=truncf compiler.c.cmd=arm-none-eabi-gcc compiler.c.flags=-c {compiler.defines} {compiler.flags} {compiler.includes} -std=gnu17 -g compiler.c.elf.cmd=arm-none-eabi-g++ -compiler.c.elf.flags={compiler.defines} {compiler.flags} -Wl,--gc-sections +compiler.c.elf.flags={compiler.defines} {compiler.flags} -Wl,--gc-sections -u _printf_float -u _scanf_float compiler.S.cmd=arm-none-eabi-gcc compiler.S.flags=-c -g -x assembler-with-cpp -MMD {compiler.includes} -g compiler.cpp.cmd=arm-none-eabi-g++ @@ -60,7 +60,7 @@ compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc, compiler.elf2hex.bin.flags=-O binary compiler.elf2hex.hex.flags=-O ihex -R .eeprom compiler.elf2hex.cmd=arm-none-eabi-objcopy -compiler.ldflags={compiler.wrap} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align +compiler.ldflags={compiler.wrap} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common compiler.size.cmd=arm-none-eabi-size compiler.define=-DARDUINO= compiler.readelf.cmd=arm-none-eabi-readelf @@ -76,29 +76,29 @@ compiler.S.extra_flags= compiler.ar.extra_flags= compiler.elf2hex.extra_flags= +# Board configuration, set in boards.txt. Present here to ensure substitution works +build.flash_length= +build.eeprom_start= +build.fs_start= +build.fs_end= + + # 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" -# USB Flags -# --------- -build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' - -# Default usb manufacturer will be replaced at compile time using -# numeric vendor ID if available or by board's specific value. -build.usb_manufacturer="Unknown" # Compile patterns # ---------------- ## Compile c files -recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {includes} "{source_file}" -o "{object_file}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} {build.usbpid} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {includes} "{source_file}" -o "{object_file}" ## Compile c++ files -recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {includes} "{source_file}" -o "{object_file}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {build.usbpid} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {includes} "{source_file}" -o "{object_file}" ## Compile S files -recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {includes} "{source_file}" -o "{object_file}" +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} {build.usbpid} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.debug_port} {build.debug_level} {includes} "{source_file}" -o "{object_file}" ## Create archives # archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value @@ -106,7 +106,8 @@ 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}" ## 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} "-Wl,--script={build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nosys.specs -Wl,--start-group {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" {runtime.platform.path}/lib/libpico.a -lm -I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/ -I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include {runtime.platform.path}/assembly/bs2_default_padded_checksummed.S -lc -lstdc++ -Wl,--end-group +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} +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-Wl,--script={build.path}/memmap_default.ld" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nosys.specs -Wl,--start-group {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "{runtime.platform.path}/lib/libpico.a" -lm "-I{runtime.platform.path}/pico-sdk/src/rp2040/hardware_regs/include/" "-I{runtime.platform.path}/pico-sdk/src/common/pico_binary_info/include" "{runtime.platform.path}/assembly/bs2_default_padded_checksummed.S" -lc -lstdc++ -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" @@ -119,8 +120,8 @@ recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_ou ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" -recipe.size.regex=\.text\s+([0-9]+).* - +recipe.size.regex=^(?:\.boot2|\.text|\.rodata|\.ARM\.extab|\.ARM\.exidx)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss|\.ram_vector_table|\.uninitialized_data)\s+([0-9]+).* tools.uf2conv.path= # Because the variable expansion doesn't allow one tool to find another, the following lines @@ -128,10 +129,15 @@ tools.uf2conv.path= # "{runtime.tools.pqt-python3.path}/python3" for JSON board manager releases. #tools.uf2conv.cmd={runtime.tools.pqt-python3.path}/python3 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.picoprobe.cmd={runtime.tools.pqt-openocd.path} +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" diff --git a/tools/makeboards.py b/tools/makeboards.py new file mode 100755 index 000000000..5e558ac8f --- /dev/null +++ b/tools/makeboards.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 + +def BuildFlashMenu(name, flashsize, fssizelist): + for fssize in fssizelist: + if fssize == 0: + fssizename = "no FS" + elif fssize < 1024 * 1024: + fssizename = "FS: %dKB" % (fssize / 1024) + else: + fssizename = "FS: %dMB" % (fssize / (1024 * 1024)) + mn="%d_%d" % (flashsize, fssize) + print("%s.menu.flash.%s=%dMB (%s)" % (name, mn, flashsize / (1024 * 1024), fssizename)) + print("%s.menu.flash.%s.upload.maximum_size=%d" % (name, mn, flashsize - 4096 - fssize)) + print("%s.menu.flash.%s.build.flash_length=%d" % (name, mn, flashsize - 4096 - fssize)) + print("%s.menu.flash.%s.build.eeprom_start=%d" % (name, mn, int("0x10000000",0) + flashsize - 4096)) + print("%s.menu.flash.%s.build.fs_start=%d" % (name, mn, int("0x10000000",0) + flashsize - 4096 - fssize)) + print("%s.menu.flash.%s.build.fs_end=%d" % (name, mn, int("0x10000000",0) + flashsize - 4096)) + +def BuildDebugPort(name): + print("%s.menu.dbgport.Disabled=Disabled" % (name)) + print("%s.menu.dbgport.Disabled.build.debug_port=" % (name)) + for p in ["Serial", "Serial1", "Serial2"]: + print("%s.menu.dbgport.%s=%s" % (name, p, p)) + print("%s.menu.dbgport.%s.build.debug_port=-DDEBUG_RP2040_PORT=%s" % (name, p, p)) + +def BuildDebugLevel(name): + for l in [ ("None", ""), ("Core", "-DDEBUG_RP2040_CORE"), ("SPI", "-DDEBUG_RP2040_SPI"), ("Wire", "DDEBUG_RP2040_WIRE"), + ("All", "-DDEBUG_RP2040_WIRE -DDEBUG_RP2040_SPI -DDEBUG_RP2040_CORE"), ("NDEBUG", "-DNDEBUG") ]: + print("%s.menu.dbglvl.%s=%s" % (name, l[0], l[0])) + print("%s.menu.dbglvl.%s.build.debug_level=%s" % (name, l[0], l[1])) + +def BuildFreq(name): + for f in [ 125, 50, 100, 133, 150, 175, 200, 225, 250, 275, 300]: + warn = "" + if f > 133: warn = " (Overclock)" + print("%s.menu.freq.%s=%s MHz%s" % (name, f, f, warn)) + print("%s.menu.freq.%s.build.f_cpu=%dL" % (name, f, f * 1000000)) + +def BuildHeader(name, prettyname, pid, boarddefine, variant, uploadtool, flashsize): + print("%s.name=%s" % (name, prettyname)) + print("%s.vid.0=0x2e8a" % (name)) + print("%s.pid.0=%s" % (name, pid)) + print("%s.build.usbpid=-DSERIALUSB_PID=%s" % (name, pid)) + print("%s.build.board=%s" % (name, boarddefine)) + print("%s.build.mcu=cortex-m0plus" % (name)) + print("%s.build.variant=%s" % (name, variant)) + print("%s.upload.tool=%s" % (name, uploadtool)) + print("%s.upload.maximum_size=%d" % (name, flashsize)) + print("%s.upload.maximum_data_size=262144" % (name)) + print("%s.upload.wait_for_upload_port=true" % (name)) + print("%s.upload.erase_cmd=" % (name)) + print("%s.serial.disableDTR=false" % (name)) + print("%s.serial.disableRTS=false" % (name)) + print("%s.build.f_cpu=125000000" % (name)) + print("%s.build.led=" % (name)) + print("%s.build.core=rp2040" % (name)) + print("%s.build.mcu=rp2040" % (name)) + print("%s.build.ldscript=memmap_default.ld" % (name)) + +def BuildGlobalMenuList(): + print("menu.BoardModel=Model") + print("menu.flash=Flash Size") + print("menu.freq=CPU Speed") + print("menu.dbgport=Debug Port") + print("menu.dbglvl=Debug Level") + + +def MakeBoard(name, prettyname, pid, boarddefine, flashsizemb): + for a, b, c in [ ["", "", "uf2conv"], ["picoprobe", " (Picoprobe)", "picoprobe"]]: + n = name + a + p = prettyname + b + fssizelist = [ 0, 64 * 1024, 128 * 1024, 256 * 1024, 512 * 1024 ] + for i in range(1, flashsizemb): + fssizelist.append(i * 1024 * 1024) + BuildHeader(n, p, pid, boarddefine, name, c, flashsizemb * 1024 * 1024) + BuildFlashMenu(n, flashsizemb * 1024 * 1024, fssizelist) + BuildFreq(n) + BuildDebugPort(n) + BuildDebugLevel(n) + +BuildGlobalMenuList() +MakeBoard("rpipico", "Raspberry Pi Pico", "0x000a", "RASPBERRY_PI_PICO", 2) +MakeBoard("adafruitfeather", "Adafruit Feather RP2040", "0x000b", "ADAFRUIT_FEATHER_RP2040", 8) +MakeBoard("generic", "Generic RP2040", "0xf00a", "GENERIC_RP2040", 16) + diff --git a/tools/simplesub.py b/tools/simplesub.py new file mode 100755 index 000000000..9ce9fbaae --- /dev/null +++ b/tools/simplesub.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +import sys +import struct +import subprocess +import re +import os +import os.path +import argparse +import time + +def main(): + parser = argparse.ArgumentParser(description='Simple text substitution') + parser.add_argument('-i', '--input', action='store', required=True, help='Path to the source file') + parser.add_argument('-o', '--out', action='store', required=True, help='Path to the output file') + parser.add_argument('-s', '--sub', action='append', nargs=2, metavar=('find', 'replace'), required=True, help='Substition') + args = parser.parse_args() + + with open(args.input, "r") as fin: + data = fin.read() + + for f, r in args.sub: + data = re.sub(f, r, data) + + with open(args.out, "w") as fout: + fout.write(data) + + +main() diff --git a/tools/uf2conv.py b/tools/uf2conv.py index 7337e6d4f..087d3b9fc 100755 --- a/tools/uf2conv.py +++ b/tools/uf2conv.py @@ -311,7 +311,7 @@ def error(msg): error("Family ID needs to be a number or one of: " + ", ".join(families.keys())) if args.serial: - if str(args.serial).startswith("/dev/tty") or str(args.serial).startswith("COM"): + if str(args.serial).startswith("/dev/tty") or str(args.serial).startswith("COM") or str(args.serial).startswith("/dev/cu"): try: print("Resetting "+str(args.serial)) try: diff --git a/variants/adafruitfeather/pins_arduino.h b/variants/adafruitfeather/pins_arduino.h new file mode 100644 index 000000000..e46003cb0 --- /dev/null +++ b/variants/adafruitfeather/pins_arduino.h @@ -0,0 +1,8 @@ +#ifndef __rpipico_pins_arduino_h__ +#define __rpipico_pins_arduino_h__ + +#define LED_BUILTIN 13 + +#include "../generic/common.h" + +#endif diff --git a/variants/rpipico/memmap_default.ld b/variants/rpipico/memmap_default.ld deleted file mode 100644 index 1a5a0ef5c..000000000 --- a/variants/rpipico/memmap_default.ld +++ /dev/null @@ -1,252 +0,0 @@ -/* Based on GCC ARM embedded samples. - Defines the following symbols for use by code: - __exidx_start - __exidx_end - __etext - __data_start__ - __preinit_array_start - __preinit_array_end - __init_array_start - __init_array_end - __fini_array_start - __fini_array_end - __data_end__ - __bss_start__ - __bss_end__ - __end__ - end - __HeapLimit - __StackLimit - __StackTop - __stack (== StackTop) -*/ - -MEMORY -{ - FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2044k /* 2048 - 4K for EEPROM */ - RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k - SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k - SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k -} -PROVIDE ( _EEPROM_start = 0x101FF000 ); - -ENTRY(_entry_point) - -SECTIONS -{ - /* Second stage bootloader is prepended to the image. It must be 256 bytes big - and checksummed. It is usually built by the boot_stage2 target - in the Pico SDK - */ - - .flash_begin : { - __flash_binary_start = .; - } > FLASH - - .boot2 : { - __boot2_start__ = .; - KEEP (*(.boot2)) - __boot2_end__ = .; - } > FLASH - - ASSERT(__boot2_end__ - __boot2_start__ == 256, - "ERROR: Pico second stage bootloader must be 256 bytes in size") - - /* The second stage will always enter the image at the start of .text. - The debugger will use the ELF entry point, which is the _entry_point - symbol if present, otherwise defaults to start of .text. - This can be used to transfer control back to the bootrom on debugger - launches only, to perform proper flash setup. - */ - - .text : { - __reset_start = .; - KEEP (*(.reset)) - . = ALIGN(256); - __reset_end = .; - ASSERT(__reset_end - __reset_start == 256, "ERROR: reset section should only be 256 bytes"); - KEEP (*(.vectors)) - /* TODO revisit this now memset/memcpy/float in ROM */ - /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from - * FLASH ... we will include any thing excluded here in .data below by default */ - *(.init) - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) - *(.fini) - /* Pull all c'tors into .text */ - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - /* Followed by destructors */ - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) - *(SORT(.dtors.*)) - *(.dtors) - - *(.eh_frame*) - . = ALIGN(4); - } > FLASH - - .rodata : { - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*) - . = ALIGN(4); - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) - . = ALIGN(4); - } > FLASH - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > FLASH - - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > FLASH - __exidx_end = .; - - /* Machine inspectable binary information */ - . = ALIGN(4); - __binary_info_start = .; - .binary_info : - { - KEEP(*(.binary_info.keep.*)) - *(.binary_info.*) - } > FLASH - __binary_info_end = .; - . = ALIGN(4); - - /* End of .text-like segments */ - __etext = .; - - .ram_vector_table (COPY): { - *(.ram_vector_table) - } > RAM - - .data : { - __data_start__ = .; - *(vtable) - - *(.time_critical*) - - /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ - *(.text*) - . = ALIGN(4); - *(.rodata*) - . = ALIGN(4); - - *(.data*) - - . = ALIGN(4); - *(.after_data.*) - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__mutex_array_start = .); - KEEP(*(SORT(.mutex_array.*))) - KEEP(*(.mutex_array)) - PROVIDE_HIDDEN (__mutex_array_end = .); - - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(SORT(.preinit_array.*))) - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - - . = ALIGN(4); - /* init data */ - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - - . = ALIGN(4); - /* finit data */ - PROVIDE_HIDDEN (__fini_array_start = .); - *(SORT(.fini_array.*)) - *(.fini_array) - PROVIDE_HIDDEN (__fini_array_end = .); - - *(.jcr) - . = ALIGN(4); - /* All data end */ - __data_end__ = .; - } > RAM AT> FLASH - - .uninitialized_data (COPY): { - . = ALIGN(4); - *(.uninitialized_data*) - } > RAM - - /* Start and end symbols must be word-aligned */ - .scratch_x : { - __scratch_x_start__ = .; - *(.scratch_x.*) - . = ALIGN(4); - __scratch_x_end__ = .; - } > SCRATCH_X AT > FLASH - __scratch_x_source__ = LOADADDR(.scratch_x); - - .scratch_y : { - __scratch_y_start__ = .; - *(.scratch_y.*) - . = ALIGN(4); - __scratch_y_end__ = .; - } > SCRATCH_Y AT > FLASH - __scratch_y_source__ = LOADADDR(.scratch_y); - - .bss : { - . = ALIGN(4); - __bss_start__ = .; - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - } > RAM - - .heap (COPY): - { - __end__ = .; - end = __end__; - *(.heap*) - __HeapLimit = .; - } > RAM - - /* .stack*_dummy section doesn't contains any symbols. It is only - * used for linker to calculate size of stack sections, and assign - * values to stack symbols later - * - * stack1 section may be empty/missing if platform_launch_core1 is not used */ - - /* by default we put core 0 stack at the end of scratch Y, so that if core 1 - * stack is not used then all of SCRATCH_X is free. - */ - .stack1_dummy (COPY): - { - *(.stack1*) - } > SCRATCH_X - .stack_dummy (COPY): - { - *(.stack*) - } > SCRATCH_Y - - .flash_end : { - __flash_binary_end = .; - } > FLASH - - /* stack limit is poorly named, but historically is maximum heap ptr */ - __StackLimit = ORIGIN(RAM) + LENGTH(RAM); - __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); - __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); - __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); - __StackBottom = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - - /* Check if data + heap + stack exceeds RAM limit */ - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") - /* todo assert on extra code */ -} -