This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d31964
commit 5fd32ec
Showing
9 changed files
with
1,411 additions
and
0 deletions.
There are no files selected for viewing
647 changes: 647 additions & 0 deletions
647
Packages_Patches/adafruit/hardware/nrf52/1.0.0/boards.txt
Large diffs are not rendered by default.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
Packages_Patches/adafruit/hardware/nrf52/1.0.0/cores/nRF5/Udp.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Udp.cpp: Library to send/receive UDP packets. | ||
* | ||
* NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) | ||
* 1) UDP does not guarantee the order in which assembled UDP packets are received. This | ||
* might not happen often in practice, but in larger network topologies, a UDP | ||
* packet can be received out of sequence. | ||
* 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being | ||
* aware of it. Again, this may not be a concern in practice on small local networks. | ||
* For more information, see http://www.cafeaulait.org/course/week12/35.html | ||
* | ||
* MIT License: | ||
* Copyright (c) 2008 Bjoern Hartmann | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* [email protected] 12/30/2008 | ||
*/ | ||
|
||
#ifndef udp_h | ||
#define udp_h | ||
|
||
#include <Stream.h> | ||
#include <IPAddress.h> | ||
|
||
class UDP : public Stream { | ||
|
||
public: | ||
virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use | ||
|
||
// KH, add virtual function to support Multicast, necessary for many services (MDNS, UPnP, etc.) | ||
virtual uint8_t beginMulticast(IPAddress, uint16_t) { return 0; } // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure | ||
|
||
virtual void stop() =0; // Finish with the UDP socket | ||
|
||
// Sending UDP packets | ||
|
||
// Start building up a packet to send to the remote host specific in ip and port | ||
// Returns 1 if successful, 0 if there was a problem with the supplied IP address or port | ||
virtual int beginPacket(IPAddress ip, uint16_t port) =0; | ||
// Start building up a packet to send to the remote host specific in host and port | ||
// Returns 1 if successful, 0 if there was a problem resolving the hostname or port | ||
virtual int beginPacket(const char *host, uint16_t port) =0; | ||
// Finish off this packet and send it | ||
// Returns 1 if the packet was sent successfully, 0 if there was an error | ||
virtual int endPacket() =0; | ||
// Write a single byte into the packet | ||
virtual size_t write(uint8_t) =0; | ||
// Write size bytes from buffer into the packet | ||
virtual size_t write(const uint8_t *buffer, size_t size) =0; | ||
|
||
// Start processing the next available incoming packet | ||
// Returns the size of the packet in bytes, or 0 if no packets are available | ||
virtual int parsePacket() =0; | ||
// Number of bytes remaining in the current packet | ||
virtual int available() =0; | ||
// Read a single byte from the current packet | ||
virtual int read() =0; | ||
// Read up to len bytes from the current packet and place them into buffer | ||
// Returns the number of bytes read, or 0 if none are available | ||
virtual int read(unsigned char* buffer, size_t len) =0; | ||
// Read up to len characters from the current packet and place them into buffer | ||
// Returns the number of characters read, or 0 if none are available | ||
virtual int read(char* buffer, size_t len) =0; | ||
// Return the next byte from the current packet without moving on to the next byte | ||
virtual int peek() =0; | ||
virtual void flush() =0; // Finish reading the current packet | ||
|
||
// Return the IP address of the host who sent the current incoming packet | ||
virtual IPAddress remoteIP() =0; | ||
// Return the port of the host who sent the current incoming packet | ||
virtual uint16_t remotePort() =0; | ||
protected: | ||
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; | ||
}; | ||
|
||
#endif |
167 changes: 167 additions & 0 deletions
167
Packages_Patches/adafruit/hardware/nrf52/1.0.0/platform.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
# Copyright (c) 2014-2015 Arduino LLC. All right reserved. | ||
# Copyright (c) 2016 Sandeep Mistry All right reserved. | ||
# Copyright (c) 2017 Adafruit Industries. All rights 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 | ||
|
||
name=Adafruit nRF52 Boards | ||
version=1.0.0 | ||
|
||
# Compile variables | ||
# ----------------- | ||
|
||
compiler.warning_flags=-w | ||
compiler.warning_flags.none=-w | ||
compiler.warning_flags.default= | ||
compiler.warning_flags.more=-Wall | ||
compiler.warning_flags.all=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith | ||
|
||
# Allow changing optimization settings via platform.local.txt / boards.local.txt | ||
compiler.optimization_flag=-Ofast | ||
|
||
compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ | ||
compiler.c.cmd=arm-none-eabi-gcc | ||
compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD | ||
|
||
# KH, Error here to use gcc, must use g++ | ||
#compiler.c.elf.cmd=arm-none-eabi-gcc | ||
compiler.c.elf.cmd=arm-none-eabi-g++ | ||
|
||
compiler.c.elf.flags={compiler.optimization_flag} -Wl,--gc-sections -save-temps | ||
compiler.S.cmd=arm-none-eabi-gcc | ||
compiler.S.flags=-mcpu={build.mcu} -mthumb -mabi=aapcs {compiler.optimization_flag} -g -c {build.float_flags} -x assembler-with-cpp | ||
|
||
compiler.cpp.cmd=arm-none-eabi-g++ | ||
compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD | ||
compiler.ar.cmd=arm-none-eabi-ar | ||
compiler.ar.flags=rcs | ||
compiler.objcopy.cmd=arm-none-eabi-objcopy | ||
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 | ||
compiler.elf2bin.flags=-O binary | ||
compiler.elf2bin.cmd=arm-none-eabi-objcopy | ||
compiler.elf2hex.flags=-O ihex | ||
compiler.elf2hex.cmd=arm-none-eabi-objcopy | ||
compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align --specs=nano.specs --specs=nosys.specs | ||
compiler.size.cmd=arm-none-eabi-size | ||
|
||
# this can be overriden in boards.txt | ||
build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float | ||
build.debug_flags=-DCFG_DEBUG=0 | ||
build.logger_flags=-DCFG_LOGGER=1 | ||
build.sysview_flags=-DCFG_SYSVIEW=0 | ||
|
||
# USB flags | ||
build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' | ||
|
||
# These can be overridden in platform.local.txt | ||
compiler.c.extra_flags= | ||
compiler.c.elf.extra_flags= | ||
compiler.cpp.extra_flags= | ||
compiler.S.extra_flags= | ||
compiler.ar.extra_flags= | ||
compiler.libraries.ldflags= | ||
compiler.elf2bin.extra_flags= | ||
compiler.elf2hex.extra_flags= | ||
|
||
compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include/" | ||
compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -larm_cortexM4lf_math | ||
|
||
# common compiler for nrf | ||
rtos.path={build.core.path}/freertos | ||
nordic.path={build.core.path}/nordic | ||
|
||
# build.logger_flags and build.sysview_flags are intentionally empty, | ||
# to allow modification via a user's own boards.local.txt or platform.local.txt files. | ||
build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 {compiler.optimization_flag} {build.debug_flags} {build.logger_flags} {build.sysview_flags} {compiler.arm.cmsis.c.flags} "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include/nrf52" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino" | ||
|
||
# Compile patterns | ||
# ---------------- | ||
|
||
## Compile c files | ||
## KH Add -DBOARD_NAME="{build.board}" | ||
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" | ||
|
||
## Compile c++ files | ||
## KH Add -DBOARD_NAME="{build.board}" | ||
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" | ||
|
||
## Compile S files | ||
## KH Add -DBOARD_NAME="{build.board}" | ||
recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" | ||
|
||
## Create archives | ||
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} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" {compiler.libraries.ldflags} -Wl,--end-group | ||
|
||
## Create output (bin file) | ||
#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" | ||
|
||
## Create output (hex file) | ||
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" | ||
|
||
## Create dfu package zip file | ||
recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" | ||
|
||
## Create uf2 file | ||
#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" | ||
|
||
## Save bin | ||
recipe.output.tmp_file_bin={build.project_name}.bin | ||
recipe.output.save_file_bin={build.project_name}.save.bin | ||
|
||
## Save hex | ||
recipe.output.tmp_file_hex={build.project_name}.hex | ||
recipe.output.save_file_hexu={build.project_name}.save.hex | ||
|
||
## Compute size | ||
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" | ||
recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* | ||
recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* | ||
|
||
## Export Compiled Binary | ||
recipe.output.tmp_file={build.project_name}.hex | ||
recipe.output.save_file={build.project_name}.{build.variant}.hex | ||
|
||
#*************************************************** | ||
# adafruit-nrfutil for uploading | ||
# https://github.com/adafruit/Adafruit_nRF52_nrfutil | ||
# pre-built binaries are provided for macos and windows | ||
#*************************************************** | ||
tools.nrfutil.cmd=adafruit-nrfutil | ||
tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe | ||
tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil | ||
|
||
tools.nrfutil.upload.params.verbose=--verbose | ||
tools.nrfutil.upload.params.quiet= | ||
tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank | ||
|
||
#*************************************************** | ||
# Burning bootloader with either jlink or nrfutil | ||
#*************************************************** | ||
|
||
# Bootloader version | ||
tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.6.1_{build.sd_name}_{build.sd_version} | ||
|
||
tools.bootburn.bootloader.params.verbose= | ||
tools.bootburn.bootloader.params.quiet= | ||
tools.bootburn.bootloader.pattern={program.burn_pattern} | ||
|
||
# erase flash page while programming | ||
tools.bootburn.erase.params.verbose= | ||
tools.bootburn.erase.params.quiet= | ||
tools.bootburn.erase.pattern= | ||
|
17 changes: 17 additions & 0 deletions
17
Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/pins_arduino.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
Copyright (c) 2014-2015 Arduino LLC. 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 | ||
*/ | ||
|
||
// API compatibility | ||
#include "variant.h" |
62 changes: 62 additions & 0 deletions
62
Packages_Patches/adafruit/hardware/nrf52/1.0.0/variants/NINA_B112_ublox/variant.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Copyright (c) 2014-2015 Arduino LLC. All right reserved. | ||
Copyright (c) 2016 Sandeep Mistry All right reserved. | ||
Copyright (c) 2018, Adafruit Industries (adafruit.com) | ||
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 | ||
*/ | ||
// Thanks to great work of [Miguel Alexandre Wisintainer](https://github.com/tcpipchip). | ||
// See [u-blox nina b](https://github.com/khoih-prog/WiFiNINA_Generic/issues/1) | ||
|
||
#include "variant.h" | ||
#include "wiring_constants.h" | ||
#include "wiring_digital.h" | ||
#include "nrf.h" | ||
|
||
const uint32_t g_ADigitalPinMap[] = { | ||
0, | ||
1, | ||
2, | ||
3, | ||
4, | ||
5, | ||
6, | ||
7, | ||
8, | ||
9, | ||
10, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
16, | ||
17, | ||
18, | ||
19, | ||
20, | ||
21, | ||
22, | ||
23, | ||
24, | ||
25, | ||
26, | ||
27, | ||
28, | ||
29, | ||
30, | ||
31 | ||
}; | ||
|
Oops, something went wrong.