├── .gitignore ├── rust-toolchain.toml ├── .cargo └── config ├── bootcrc ├── Cargo.toml └── src │ └── main.rs ├── Cargo.toml ├── link.x ├── README.mkdn ├── src └── main.rs ├── Cargo.lock └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /bin 3 | /elf 4 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly-2022-02-22" 3 | targets = ["thumbv6m-none-eabi"] 4 | profile = "minimal" 5 | -------------------------------------------------------------------------------- /.cargo/config: -------------------------------------------------------------------------------- 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] 2 | rustflags = [ 3 | "-C", "link-arg=--nmagic", 4 | "-C", "link-arg=-Tlink.x", 5 | ] 6 | -------------------------------------------------------------------------------- /bootcrc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bootcrc" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | crc-any = "2.3" 10 | clap = {version = "3", features = ["derive"]} 11 | goblin = "0.4" 12 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rp2040-rustboot" 3 | version = "0.1.0" 4 | edition = "2021" 5 | license = "MPL-2.0" 6 | 7 | [features] 8 | chip-w25q080 = [] 9 | chip-gd25q64 = ["supports-write-status2"] 10 | chip-at25sf128a = ["supports-write-status2"] 11 | 12 | supports-write-status2 = [] 13 | 14 | [dependencies] 15 | rp2040-pac = "0.3" 16 | panic-halt = "0.2" 17 | cfg-if = "1" 18 | 19 | # This is just here so RLS works. 20 | [[bin]] 21 | name = "rp2040-rustboot" 22 | test = false 23 | bench = false 24 | 25 | [workspace] 26 | members = [ 27 | "bootcrc", 28 | ] 29 | 30 | [profile.release] 31 | codegen-units = 1 32 | debug = true 33 | lto = true 34 | opt-level = "z" 35 | -------------------------------------------------------------------------------- /link.x: -------------------------------------------------------------------------------- 1 | MEMORY { 2 | FLASH : ORIGIN = 0x10000000, LENGTH = 256 3 | 4 | RAM : ORIGIN = 0x20000000, LENGTH = 264K 5 | } 6 | 7 | ENTRY(reset_handler); 8 | 9 | SECTIONS { 10 | /* The ROM doesn't actually give us a choice in this, but, hey. */ 11 | PROVIDE(_stack_start = ORIGIN(RAM) + LENGTH(RAM)); 12 | PROVIDE(_stext = ORIGIN(FLASH)); 13 | 14 | .text _stext : { 15 | *(.reset_handler .reset_handler.*); 16 | *(.text .text.*); 17 | . = ALIGN(4); 18 | __etext = .; 19 | } >FLASH 20 | 21 | .rodata __etext : ALIGN(4) { 22 | *(.rodata .rodata.*); 23 | . = ALIGN(4); 24 | __erodata = .; 25 | } >FLASH 26 | 27 | .pad : { 28 | . = ORIGIN(FLASH) + 252; 29 | } >FLASH 30 | 31 | .crc : { 32 | LONG(0xEFBEADDE); 33 | } >FLASH 34 | 35 | /* 36 | * These RAM sections are here to detect anything being errantly placed 37 | * in them. Because we boot without an r0 we can't actually use RAM. 38 | */ 39 | .data : { 40 | __sdata = .; 41 | *(.data .data.*); 42 | __edata = .; 43 | } >RAM AT>FLASH 44 | 45 | .bss (NOLOAD) : { 46 | __sbss = .; 47 | *(.bss .bss.*); 48 | __ebss = .; 49 | } >RAM 50 | 51 | /* Detect accidental got usage too. */ 52 | .got (NOLOAD) : { 53 | KEEP(*(.got .got.*)); 54 | } 55 | 56 | /DISCARD/ : { 57 | *(.ARM.exidx); 58 | *(.ARM.exidx.*); 59 | *(.ARM.extab.*); 60 | } 61 | } 62 | 63 | ASSERT(__sbss == __ebss, "MUST NOT USE RAM"); 64 | ASSERT(__sdata == __edata, "MUST NOT USE RAM"); 65 | -------------------------------------------------------------------------------- /README.mkdn: -------------------------------------------------------------------------------- 1 | # RP2040 Flash Bootloader in Rust 2 | 3 | The RP2040 uses a two-stage bootloader scheme, where ROM loads the first 256 4 | bytes from an attached Flash chip into RAM and executes it. That 256 byte 5 | program is responsible for setting up Flash to run the _rest_ of the code. 6 | 7 | Normally this program is written in assembly language. I was curious to see if 8 | it could be done in Rust. 9 | 10 | It appears that it can, and the result is smaller than the assembly language 11 | version. 12 | 13 | ## Building the bootloader images. 14 | 15 | Built and known to work: 16 | 17 | - Winbond W25Q080 (and similar), as seen on the Pi Pico. 18 | - GigaDevices GD25Q64CS (and similar), as seen on certain Adafruit boards. 19 | 20 | There's also untested support for AT25SF128A parts. 21 | 22 | You do not need the ARM GCC toolchain or binutils installed. 23 | 24 | Run the `build-all.sh` script inside the repo. This will build the bootloader 25 | for each supported flash chip, as well as the `bootcrc` tool which converts its 26 | ELF file into the format expected by the RP2040. 27 | 28 | Bootloader binary files are deposited into the `bin` directory. 29 | 30 | ## Constraints 31 | 32 | The bootloader needs to fit into 256 bytes (well, technically 252, unless you 33 | can devise a program whose final two instructions are also its CRC). To save 34 | space, I have chosen to not initialize RAM (data/bss). This means the bootloader 35 | must not use it. Only stack is permitted. This makes it slightly hard to use the 36 | PACs, which like global variables, but, it can be done. The linker script will 37 | fail the build if you accidentally use RAM. 38 | 39 | The toolchain version is pinned. I recommend this as a general practice, but 40 | it's even _more_ important in this case because small code generation changes 41 | that go unnoticed by desktop Rust developers could blow our size budget. The 42 | bootloader is known to fit when built with this toolchain only. It _might_ build 43 | with other toolchains. Such is our lot as embedded developers. 44 | -------------------------------------------------------------------------------- /bootcrc/src/main.rs: -------------------------------------------------------------------------------- 1 | use clap::Parser; 2 | use std::path::PathBuf; 3 | use std::io::{Seek, SeekFrom, Write}; 4 | 5 | #[derive(Parser)] 6 | struct Bootcrc { 7 | #[clap(short, long)] 8 | update: bool, 9 | 10 | input: PathBuf, 11 | output: PathBuf, 12 | } 13 | 14 | const BOGUS_CRC: &[u8] = &[0xDE, 0xAD, 0xBE, 0xEF]; 15 | 16 | fn main() -> Result<(), Box> { 17 | let args = Bootcrc::parse(); 18 | 19 | let elf_image = std::fs::read(&args.input)?; 20 | 21 | let elf = goblin::elf::Elf::parse(&elf_image)?; 22 | 23 | let mut load_phdrs = elf.program_headers.iter() 24 | .filter(|phdr| phdr.p_type == goblin::elf::program_header::PT_LOAD); 25 | 26 | assert_eq!(load_phdrs.clone().count(), 1, "bootloader image should have one PHDR."); 27 | 28 | let phdr = load_phdrs.next().unwrap(); 29 | 30 | let offset = usize::try_from(phdr.p_offset)?; 31 | let size = usize::try_from(phdr.p_filesz)?; 32 | let data = &elf_image[offset..offset + size]; 33 | 34 | println!("bootloader length before padding: {}", data.len()); 35 | 36 | let mut data = data.to_vec(); 37 | 38 | let room_for_update = if data.len() == 256 && &data[252..256] == BOGUS_CRC { 39 | // Shave off the last four bytes. 40 | data.resize(252, 0); 41 | true 42 | } else { 43 | false 44 | }; 45 | 46 | if data.len() > 252 { 47 | panic!("bootloader too large"); 48 | } else if data.len() < 252 { 49 | // Pad with zeros to length. 50 | data.resize(252_usize, 0_u8); 51 | } 52 | 53 | let crc = { 54 | let mut c = crc_any::CRCu32::crc32mpeg2(); 55 | c.digest(&data); 56 | c.get_crc() 57 | }; 58 | 59 | data.extend(crc.to_le_bytes()); 60 | 61 | if args.update { 62 | if room_for_update { 63 | println!("updating {}", args.input.display()); 64 | let mut upd = std::fs::OpenOptions::new() 65 | .write(true) 66 | .create(false) 67 | .open(&args.input)?; 68 | upd.seek(SeekFrom::Start(offset as u64 + 252))?; 69 | upd.write_all(&data[252..256])?; 70 | drop(upd); 71 | } else { 72 | panic!("can't update ELF file: section too small"); 73 | } 74 | } 75 | 76 | std::fs::write(args.output, data)?; 77 | 78 | println!("success, crc = 0x{:08x}", crc); 79 | 80 | Ok(()) 81 | } 82 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | // This Source Code Form is subject to the terms of the Mozilla Public 2 | // License, v. 2.0. If a copy of the MPL was not distributed with this 3 | // file, You can obtain one at https://mozilla.org/MPL/2.0/. 4 | 5 | //! A bootloader for running programs out of QSPI Flash on the RP2040. 6 | //! 7 | //! The RP2040 boot ROM loads the first 256 bytes from an attached flash chip 8 | //! using very conservative settings. It then checks a CRC and, if valid, jumps 9 | //! to the start of the block. The program in those 256 bytes is responsible for 10 | //! reconfiguring the flash chip as desired for higher performance, and then 11 | //! jumping into the _real_ application (which normally starts at offset 256 12 | //! into the flash). 13 | //! 14 | //! The official bootloaders are written in assembly and rely on the C SDK. This 15 | //! one is written in Rust and does not. I've also analyzed the assembly 16 | //! bootloaders (of which there are several, copies of one another) and 17 | //! extracted their differences into Cargo features. 18 | 19 | #![no_std] 20 | #![no_main] 21 | 22 | // needed for the cheap reset facade below. 23 | #![feature(naked_functions)] 24 | 25 | use panic_halt as _; 26 | 27 | /////////////////////////////////////////////////////////////////////////// 28 | // Tunables. 29 | 30 | const PICO_FLASH_SPI_CLKDIV: u16 = 4; 31 | 32 | /////////////////////////////////////////////////////////////////////////// 33 | // Flash configuration. 34 | 35 | cfg_if::cfg_if! { 36 | if #[cfg(any(feature = "chip-w25q080", feature = "chip-at25sf128a"))] { 37 | const CMD_READ: u32 = 0xeb; 38 | const WAIT_CYCLES: u8 = 4; 39 | } else if #[cfg(feature = "chip-gd25q64")] { 40 | const CMD_READ: u32 = 0xe7; 41 | const WAIT_CYCLES: u8 = 2; 42 | } else { 43 | compile_error!("must define a chip-* feature"); 44 | } 45 | } 46 | 47 | const CMD_WRITE_STATUS: u32 = 0x01; 48 | const CMD_WRITE_STATUS2: u32 = 0x31; 49 | const CMD_READ_STATUS: u32 = 0x05; 50 | const CMD_WRITE_ENABLE: u32 = 0x06; 51 | const CMD_READ_STATUS2: u32 = 0x35; 52 | const STATUS2_VALUE: u32 = 0x02; 53 | const MODE_CONTINUOUS_READ: u8 = 0xA0; 54 | 55 | // Number of address + mode bits. 56 | const ADDR_MODE_BIT_COUNT: u8 = 32; 57 | const ADDR_L: u8 = ADDR_MODE_BIT_COUNT / 4; 58 | 59 | /////////////////////////////////////////////////////////////////////////// 60 | // Code 61 | 62 | /// Reset façade. This is the first thing executed after ROM, and it's 63 | /// responsible for forwarding execution into `safe_reset` below and then 64 | /// jumping into the app. 65 | /// 66 | /// Jumping into the app merits some additional discussion. The ROM passes us 67 | /// the app information in LR, effectively acting as the return address; we're 68 | /// expected to do one of two things: 69 | /// 70 | /// 1. If LR is 0: read the Flash vector table that immediately follows our code 71 | /// and jump into it. 72 | /// 73 | /// 2. If LR is not zero: jump where it points instead. 74 | /// 75 | /// Either way, that jump will be our final act. 76 | #[link_section = ".reset_handler"] 77 | #[no_mangle] 78 | #[naked] 79 | pub unsafe extern "C" fn reset_handler() -> ! { 80 | core::arch::asm!( 81 | " 82 | mov r4, lr @ back up return address in caller-save reg 83 | bl safe_reset @ do the Rust part below 84 | cmp r4, #0 @ was the return address zero? 85 | bne 1f @ if not, jump ahead to branch to it. 86 | 87 | ldr r0, =0x10000100 @ address of code after bootloader in XIP 88 | ldr r1, =0xE000ED08 @ address of VTOR in SCS 89 | str r0, [r1] @ set vector table to start of code 90 | ldmia r0!, {{r3, r4}} @ read initial SP, PC 91 | mov sp, r3 @ configure initial SP 92 | 93 | 1: bx r4 @ and jump to initial PC 94 | ", 95 | options(noreturn), 96 | ) 97 | } 98 | 99 | #[no_mangle] 100 | extern "C" fn safe_reset() { 101 | // This is like Peripherals::steal, but that function insists on using RAM. 102 | // This doesn't. 103 | let p: rp2040_pac::Peripherals = unsafe { 104 | core::mem::transmute(()) 105 | }; 106 | 107 | // Reconfigure our pads to allow faster operation. 108 | // 109 | // On SCK, we want more drive current (8mA) and fast slew rate. 110 | p.PADS_QSPI.gpio_qspi_sclk.write(|w| { 111 | w.drive()._8m_a() 112 | .slewfast().set_bit() 113 | }); 114 | 115 | // On the four data lines, we just want to disable the Schmitt trigger to 116 | // reduce propagation delay on inputs. It seems we trust the QSPI Flash to 117 | // drive the outputs firmly in one direction or the other. 118 | p.PADS_QSPI.gpio_qspi_sd0.write(|w| w.schmitt().clear_bit()); 119 | p.PADS_QSPI.gpio_qspi_sd1.write(|w| w.schmitt().clear_bit()); 120 | p.PADS_QSPI.gpio_qspi_sd2.write(|w| w.schmitt().clear_bit()); 121 | p.PADS_QSPI.gpio_qspi_sd3.write(|w| w.schmitt().clear_bit()); 122 | 123 | // Disable the SSI as a prerequisite for changing most of its config 124 | // registers. 125 | disable_ssi(&p.XIP_SSI); 126 | 127 | // Set the SSI clock divider to our chosen value. 128 | p.XIP_SSI.baudr.write(|w| unsafe { 129 | w.sckdv().bits(PICO_FLASH_SPI_CLKDIV) 130 | }); 131 | 132 | // Configure for one SCK cycle delay on RXD sampling. The original 133 | // bootloader asserts that this is important if PICO_FLASH_SPI_CLKDIV is 2 134 | // to try and maintain the hold times for RXD; and that it has no effect 135 | // otherwise. I haven't tested this. 136 | p.XIP_SSI.rx_sample_dly.write(|w| unsafe { w.rsd().bits(1) }); 137 | 138 | // Set the data frame size in 32-bit mode to 8 bits, and configure to both 139 | // transmit and receive. 140 | // 141 | // Note that this implicitly selects 1-SPI mode by setting the FRF field to 142 | // its reset value. 143 | p.XIP_SSI.ctrlr0.write(|w| unsafe { 144 | w.dfs_32().bits(7) 145 | .tmod().tx_and_rx() 146 | }); 147 | // Turn the SSI back on so we can use it to poke the Flash chip by reading 148 | // its status registers. 149 | enable_ssi(&p.XIP_SSI); 150 | let sreg = read_flash_sreg(&p.XIP_SSI, CMD_READ_STATUS2); 151 | 152 | // Check that the status register indicates QSPI mode. Reprogram it if not. 153 | if sreg != STATUS2_VALUE { 154 | p.XIP_SSI.dr0.write(|w| unsafe { w.bits(CMD_WRITE_ENABLE) }); 155 | wait_ssi_ready(&p.XIP_SSI); 156 | p.XIP_SSI.dr0.read(); 157 | 158 | if cfg!(feature = "supports-write-status2") { 159 | p.XIP_SSI.dr0.write(|w| unsafe { w.bits(CMD_WRITE_STATUS2) }); 160 | } else { 161 | // Issue a two-byte write to STATUS, which overwrites more than 162 | // we'd like, but the W25Q080 (at least) doesn't support 163 | // single-byte writes to STATUS2 only. 164 | p.XIP_SSI.dr0.write(|w| unsafe { w.bits(CMD_WRITE_STATUS) }); 165 | // Dummy extra byte 166 | p.XIP_SSI.dr0.write(|w| unsafe { w.bits(0) }); 167 | } 168 | // Write the SREG STATUS2 data regardless. 169 | p.XIP_SSI.dr0.write(|w| unsafe { w.bits(STATUS2_VALUE) }); 170 | 171 | wait_ssi_ready(&p.XIP_SSI); 172 | p.XIP_SSI.dr0.read(); 173 | p.XIP_SSI.dr0.read(); 174 | p.XIP_SSI.dr0.read(); 175 | 176 | while read_flash_sreg(&p.XIP_SSI, CMD_READ_STATUS) & 1 != 0 {} 177 | } 178 | 179 | // Turn SSI back off so we can reconfigure things again. 180 | disable_ssi(&p.XIP_SSI); 181 | 182 | // Reconfigure for 183 | // - QSPI mode 184 | // - 32 bit frames 185 | // - TX-then-RX mode ("eeprom read") 186 | p.XIP_SSI.ctrlr0.write(|w| unsafe { 187 | w.spi_frf().quad() 188 | .dfs_32().bits(31) 189 | .tmod().eeprom_read() 190 | }); 191 | // Configure for zero(?) control frames before we turn the bus around. (I 192 | // assume this is an undocumented N-1 field and this actually means 1 193 | // control frame.) 194 | p.XIP_SSI.ctrlr1.write(|w| unsafe { w.ndf().bits(0) }); 195 | 196 | // Configure transaction shape: address/mode bits, wait cycles, instruction 197 | // length (8 bit), and transaction type (1SPI command followed by QSPI 198 | // address). 199 | p.XIP_SSI.spi_ctrlr0.write(|w| unsafe { 200 | w.addr_l().bits(ADDR_L) 201 | .wait_cycles().bits(WAIT_CYCLES) 202 | .inst_l()._8b() 203 | .trans_type()._1c2a() 204 | }); 205 | 206 | // Aight, turn it back on so we can talk to the Flash. 207 | enable_ssi(&p.XIP_SSI); 208 | 209 | // Enqueue a READ command followed by the continuous-read mode bits. This 210 | // lets us issue more reads without issuing a command byte. 211 | p.XIP_SSI.dr0.write(|w| unsafe { w.bits(CMD_READ) }); 212 | p.XIP_SSI.dr0.write(|w| unsafe { w.bits(MODE_CONTINUOUS_READ as u32) }); 213 | 214 | wait_ssi_ready(&p.XIP_SSI); 215 | 216 | // Okay, with the Flash waiting in continuous-read mode, we want to 217 | // reconfigure the SSI _again._ Last time, I promise. 218 | disable_ssi(&p.XIP_SSI); 219 | 220 | // Turn on XIP / memory mapping, turn off instructions, and ensure that 221 | // everything happens in QSPI mode. 222 | p.XIP_SSI.spi_ctrlr0.write(|w| unsafe { 223 | w.xip_cmd().bits(MODE_CONTINUOUS_READ) 224 | .addr_l().bits(ADDR_L) 225 | .wait_cycles().bits(WAIT_CYCLES) 226 | .inst_l().none() 227 | .trans_type()._2c2a() 228 | }); 229 | 230 | // And, back on! We can now address the flash. 231 | enable_ssi(&p.XIP_SSI); 232 | } 233 | 234 | /// Sends `status_read_cmd` and collects a result. This must be issued while 235 | /// we're in "eeprom mode" with CTRLR1.NDF configured correctly. 236 | fn read_flash_sreg(ssi: &rp2040_pac::XIP_SSI, status_read_cmd: u32) -> u32 { 237 | ssi.dr0.write(|w| unsafe { w.bits(status_read_cmd) }); 238 | // Dummy byte: 239 | ssi.dr0.write(|w| unsafe { w.bits(status_read_cmd) }); 240 | 241 | wait_ssi_ready(ssi); 242 | 243 | // Discard first byte 244 | ssi.dr0.read(); 245 | ssi.dr0.read().bits() 246 | } 247 | 248 | /// Poll SSI SR until (1) Transmit Fifo Empty is set and (2) Busy is not set. 249 | fn wait_ssi_ready(ssi: &rp2040_pac::XIP_SSI) { 250 | while { 251 | let sr = ssi.sr.read(); 252 | !sr.tfe().bit() || sr.busy().bit() 253 | } {} 254 | } 255 | 256 | #[inline(always)] 257 | fn disable_ssi(ssi: &rp2040_pac::XIP_SSI) { 258 | ssi.ssienr.write(|w| w.ssi_en().clear_bit()); 259 | } 260 | 261 | #[inline(always)] 262 | fn enable_ssi(ssi: &rp2040_pac::XIP_SSI) { 263 | ssi.ssienr.write(|w| w.ssi_en().set_bit()); 264 | } 265 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "atty" 7 | version = "0.2.14" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 10 | dependencies = [ 11 | "hermit-abi", 12 | "libc", 13 | "winapi", 14 | ] 15 | 16 | [[package]] 17 | name = "autocfg" 18 | version = "1.1.0" 19 | source = "registry+https://github.com/rust-lang/crates.io-index" 20 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 21 | 22 | [[package]] 23 | name = "bare-metal" 24 | version = "0.2.5" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" 27 | dependencies = [ 28 | "rustc_version", 29 | ] 30 | 31 | [[package]] 32 | name = "bitfield" 33 | version = "0.13.2" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 36 | 37 | [[package]] 38 | name = "bitflags" 39 | version = "1.3.2" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 42 | 43 | [[package]] 44 | name = "bootcrc" 45 | version = "0.1.0" 46 | dependencies = [ 47 | "clap", 48 | "crc-any", 49 | "goblin", 50 | ] 51 | 52 | [[package]] 53 | name = "cfg-if" 54 | version = "1.0.0" 55 | source = "registry+https://github.com/rust-lang/crates.io-index" 56 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 57 | 58 | [[package]] 59 | name = "clap" 60 | version = "3.1.17" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "47582c09be7c8b32c0ab3a6181825ababb713fde6fff20fc573a3870dd45c6a0" 63 | dependencies = [ 64 | "atty", 65 | "bitflags", 66 | "clap_derive", 67 | "clap_lex", 68 | "indexmap", 69 | "lazy_static", 70 | "strsim", 71 | "termcolor", 72 | "textwrap", 73 | ] 74 | 75 | [[package]] 76 | name = "clap_derive" 77 | version = "3.1.7" 78 | source = "registry+https://github.com/rust-lang/crates.io-index" 79 | checksum = "a3aab4734e083b809aaf5794e14e756d1c798d2c69c7f7de7a09a2f5214993c1" 80 | dependencies = [ 81 | "heck", 82 | "proc-macro-error", 83 | "proc-macro2", 84 | "quote", 85 | "syn", 86 | ] 87 | 88 | [[package]] 89 | name = "clap_lex" 90 | version = "0.2.0" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213" 93 | dependencies = [ 94 | "os_str_bytes", 95 | ] 96 | 97 | [[package]] 98 | name = "cortex-m" 99 | version = "0.7.4" 100 | source = "registry+https://github.com/rust-lang/crates.io-index" 101 | checksum = "37ff967e867ca14eba0c34ac25cd71ea98c678e741e3915d923999bb2fe7c826" 102 | dependencies = [ 103 | "bare-metal", 104 | "bitfield", 105 | "embedded-hal", 106 | "volatile-register", 107 | ] 108 | 109 | [[package]] 110 | name = "crc-any" 111 | version = "2.4.2" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | checksum = "a3fc9f32c34de51ba0a727fd84d2cc83587efeca519cfca1105e3efa9c1c78fb" 114 | dependencies = [ 115 | "debug-helper", 116 | ] 117 | 118 | [[package]] 119 | name = "debug-helper" 120 | version = "0.3.13" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" 123 | 124 | [[package]] 125 | name = "embedded-hal" 126 | version = "0.2.7" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 129 | dependencies = [ 130 | "nb 0.1.3", 131 | "void", 132 | ] 133 | 134 | [[package]] 135 | name = "goblin" 136 | version = "0.4.3" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | checksum = "32401e89c6446dcd28185931a01b1093726d0356820ac744023e6850689bf926" 139 | dependencies = [ 140 | "log", 141 | "plain", 142 | "scroll", 143 | ] 144 | 145 | [[package]] 146 | name = "hashbrown" 147 | version = "0.11.2" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 150 | 151 | [[package]] 152 | name = "heck" 153 | version = "0.4.0" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" 156 | 157 | [[package]] 158 | name = "hermit-abi" 159 | version = "0.1.19" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 162 | dependencies = [ 163 | "libc", 164 | ] 165 | 166 | [[package]] 167 | name = "indexmap" 168 | version = "1.8.1" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" 171 | dependencies = [ 172 | "autocfg", 173 | "hashbrown", 174 | ] 175 | 176 | [[package]] 177 | name = "lazy_static" 178 | version = "1.4.0" 179 | source = "registry+https://github.com/rust-lang/crates.io-index" 180 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 181 | 182 | [[package]] 183 | name = "libc" 184 | version = "0.2.125" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" 187 | 188 | [[package]] 189 | name = "log" 190 | version = "0.4.14" 191 | source = "registry+https://github.com/rust-lang/crates.io-index" 192 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 193 | dependencies = [ 194 | "cfg-if", 195 | ] 196 | 197 | [[package]] 198 | name = "nb" 199 | version = "0.1.3" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 202 | dependencies = [ 203 | "nb 1.0.0", 204 | ] 205 | 206 | [[package]] 207 | name = "nb" 208 | version = "1.0.0" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" 211 | 212 | [[package]] 213 | name = "os_str_bytes" 214 | version = "6.0.0" 215 | source = "registry+https://github.com/rust-lang/crates.io-index" 216 | checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" 217 | 218 | [[package]] 219 | name = "panic-halt" 220 | version = "0.2.0" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" 223 | 224 | [[package]] 225 | name = "plain" 226 | version = "0.2.3" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" 229 | 230 | [[package]] 231 | name = "proc-macro-error" 232 | version = "1.0.4" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 235 | dependencies = [ 236 | "proc-macro-error-attr", 237 | "proc-macro2", 238 | "quote", 239 | "syn", 240 | "version_check", 241 | ] 242 | 243 | [[package]] 244 | name = "proc-macro-error-attr" 245 | version = "1.0.4" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 248 | dependencies = [ 249 | "proc-macro2", 250 | "quote", 251 | "version_check", 252 | ] 253 | 254 | [[package]] 255 | name = "proc-macro2" 256 | version = "1.0.38" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "9027b48e9d4c9175fa2218adf3557f91c1137021739951d4932f5f8268ac48aa" 259 | dependencies = [ 260 | "unicode-xid", 261 | ] 262 | 263 | [[package]] 264 | name = "quote" 265 | version = "1.0.18" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" 268 | dependencies = [ 269 | "proc-macro2", 270 | ] 271 | 272 | [[package]] 273 | name = "rp2040-pac" 274 | version = "0.3.0" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | checksum = "13a6106d5db01c7171a39c1f7696780912db9b42fe7ac722db60069c8904ea7c" 277 | dependencies = [ 278 | "cortex-m", 279 | "vcell", 280 | ] 281 | 282 | [[package]] 283 | name = "rp2040-rustboot" 284 | version = "0.1.0" 285 | dependencies = [ 286 | "cfg-if", 287 | "panic-halt", 288 | "rp2040-pac", 289 | ] 290 | 291 | [[package]] 292 | name = "rustc_version" 293 | version = "0.2.3" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 296 | dependencies = [ 297 | "semver", 298 | ] 299 | 300 | [[package]] 301 | name = "scroll" 302 | version = "0.10.2" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "fda28d4b4830b807a8b43f7b0e6b5df875311b3e7621d84577188c175b6ec1ec" 305 | dependencies = [ 306 | "scroll_derive", 307 | ] 308 | 309 | [[package]] 310 | name = "scroll_derive" 311 | version = "0.10.5" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | checksum = "aaaae8f38bb311444cfb7f1979af0bc9240d95795f75f9ceddf6a59b79ceffa0" 314 | dependencies = [ 315 | "proc-macro2", 316 | "quote", 317 | "syn", 318 | ] 319 | 320 | [[package]] 321 | name = "semver" 322 | version = "0.9.0" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 325 | dependencies = [ 326 | "semver-parser", 327 | ] 328 | 329 | [[package]] 330 | name = "semver-parser" 331 | version = "0.7.0" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 334 | 335 | [[package]] 336 | name = "strsim" 337 | version = "0.10.0" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 340 | 341 | [[package]] 342 | name = "syn" 343 | version = "1.0.92" 344 | source = "registry+https://github.com/rust-lang/crates.io-index" 345 | checksum = "7ff7c592601f11445996a06f8ad0c27f094a58857c2f89e97974ab9235b92c52" 346 | dependencies = [ 347 | "proc-macro2", 348 | "quote", 349 | "unicode-xid", 350 | ] 351 | 352 | [[package]] 353 | name = "termcolor" 354 | version = "1.1.3" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" 357 | dependencies = [ 358 | "winapi-util", 359 | ] 360 | 361 | [[package]] 362 | name = "textwrap" 363 | version = "0.15.0" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" 366 | 367 | [[package]] 368 | name = "unicode-xid" 369 | version = "0.2.3" 370 | source = "registry+https://github.com/rust-lang/crates.io-index" 371 | checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" 372 | 373 | [[package]] 374 | name = "vcell" 375 | version = "0.1.3" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 378 | 379 | [[package]] 380 | name = "version_check" 381 | version = "0.9.4" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 384 | 385 | [[package]] 386 | name = "void" 387 | version = "1.0.2" 388 | source = "registry+https://github.com/rust-lang/crates.io-index" 389 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 390 | 391 | [[package]] 392 | name = "volatile-register" 393 | version = "0.2.1" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" 396 | dependencies = [ 397 | "vcell", 398 | ] 399 | 400 | [[package]] 401 | name = "winapi" 402 | version = "0.3.9" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 405 | dependencies = [ 406 | "winapi-i686-pc-windows-gnu", 407 | "winapi-x86_64-pc-windows-gnu", 408 | ] 409 | 410 | [[package]] 411 | name = "winapi-i686-pc-windows-gnu" 412 | version = "0.4.0" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 415 | 416 | [[package]] 417 | name = "winapi-util" 418 | version = "0.1.5" 419 | source = "registry+https://github.com/rust-lang/crates.io-index" 420 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 421 | dependencies = [ 422 | "winapi", 423 | ] 424 | 425 | [[package]] 426 | name = "winapi-x86_64-pc-windows-gnu" 427 | version = "0.4.0" 428 | source = "registry+https://github.com/rust-lang/crates.io-index" 429 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 430 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | --------------------------------------------------------------------------------