mirror of
https://github.com/oltaco/Adafruit_nRF52_Bootloader_OTAFIX.git
synced 2026-10-24 17:14:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eefbe6bda9 | ||
|
|
ab74be4811 | ||
|
|
488711a9b3 | ||
|
|
91fc6735e9 | ||
|
|
6b62aacdc9 | ||
|
|
4f747e416b | ||
|
|
155dedb048 |
No files matched your search
@@ -49,6 +49,8 @@ OUT_NAME = $(BOARD)_bootloader-$(GIT_VERSION)
|
||||
# merged file = compiled + sd
|
||||
MERGED_FILE = $(OUT_NAME)_$(SD_NAME)_$(SD_VERSION)
|
||||
|
||||
UF2_FAMILY_ID_BOOTLOADER = 0xd663823c
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Tool Configure
|
||||
#------------------------------------------------------------------------------
|
||||
@@ -435,7 +437,7 @@ $(BUILD)/$(OUT_NAME)_nosd.hex: $(BUILD)/$(OUT_NAME).hex
|
||||
# Bootolader self-update uf2
|
||||
$(BUILD)/update-$(OUT_NAME)_nosd.uf2: $(BUILD)/$(OUT_NAME)_nosd.hex
|
||||
@echo Create $(notdir $@)
|
||||
@python3 lib/uf2/utils/uf2conv.py -f 0xd663823c -c -o $@ $^
|
||||
@python3 lib/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID_BOOTLOADER) -c -o $@ $^
|
||||
|
||||
# merge bootloader and sd hex together
|
||||
$(BUILD)/$(MERGED_FILE).hex: $(BUILD)/$(OUT_NAME).hex
|
||||
@@ -488,6 +490,11 @@ flash-mbr:
|
||||
@echo Flashing: $(MBR_HEX)
|
||||
$(call FLASH_NOUICR_CMD,$(MBR_HEX))
|
||||
|
||||
# flash using uf2
|
||||
flash-uf2: $(BUILD)/update-$(OUT_NAME)_nosd.uf2
|
||||
@echo Flashing: $(notdir $<)
|
||||
python lib/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID_BOOTLOADER) --deploy $<
|
||||
|
||||
# dfu with adafruit-nrfutil using CDC interface
|
||||
dfu-flash: flash-dfu
|
||||
flash-dfu: $(BUILD)/$(MERGED_FILE).zip
|
||||
|
||||
+7
-7
@@ -27,14 +27,14 @@
|
||||
#include "app_scheduler.h"
|
||||
#include "app_timer.h"
|
||||
|
||||
#ifdef LED_APA102
|
||||
#ifdef LED_APA102_CLK
|
||||
#include "nrf_spim.h"
|
||||
#endif
|
||||
|
||||
#define SCHED_MAX_EVENT_DATA_SIZE sizeof(app_timer_event_t) /**< Maximum size of scheduler events. */
|
||||
#define SCHED_QUEUE_SIZE 30 /**< Maximum number of events in the scheduler queue. */
|
||||
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102)
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102_CLK)
|
||||
void neopixel_init(void);
|
||||
void neopixel_write(uint8_t* pixels);
|
||||
void neopixel_teardown(void);
|
||||
@@ -86,7 +86,7 @@ void board_init(void) {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102)
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102_CLK)
|
||||
// use neopixel for use enumeration
|
||||
#ifdef NEOPIXEL_POWER_PIN
|
||||
nrf_gpio_cfg_output(NEOPIXEL_POWER_PIN);
|
||||
@@ -147,7 +147,7 @@ void board_teardown(void) {
|
||||
led_pwm_teardown();
|
||||
#endif
|
||||
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102)
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102_CLK)
|
||||
neopixel_teardown();
|
||||
#endif
|
||||
|
||||
@@ -362,7 +362,7 @@ static uint32_t primary_cycle_length;
|
||||
static uint32_t secondary_cycle_length;
|
||||
#endif
|
||||
|
||||
void led_tick() {
|
||||
void led_tick(void) {
|
||||
uint32_t millis = _systick_count;
|
||||
|
||||
uint32_t cycle = millis % primary_cycle_length;
|
||||
@@ -452,7 +452,7 @@ void led_state(uint32_t state) {
|
||||
final_color = (uint8_t*) &rgb_color;
|
||||
}
|
||||
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102)
|
||||
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN) || defined(LED_APA102_CLK)
|
||||
if (final_color != NULL) {
|
||||
neopixel_write(final_color);
|
||||
}
|
||||
@@ -560,7 +560,7 @@ void neopixel_write(uint8_t* pixels) {
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef LED_APA102
|
||||
#ifdef LED_APA102_CLK
|
||||
#define BYTE_PER_PIXEL 4
|
||||
|
||||
// 4 zero bytes are required to initiate update
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
set(MCU_VARIANT nrf52840)
|
||||
@@ -34,9 +34,14 @@
|
||||
#define LED_PRIMARY_PIN _PINNUM(0, 6)
|
||||
#define LED_STATE_ON 1
|
||||
|
||||
#define LED_NEOPIXEL _PINNUM(0, 8)
|
||||
#define NEOPIXELS_NUMBER 1
|
||||
#define BOARD_RGB_BRIGHTNESS 0x040404
|
||||
#define LED_APA102_CLK _PINNUM(1, 9)
|
||||
#define LED_APA102_DATA _PINNUM(0, 8)
|
||||
#define LED_APA102_BRIGHTNESS 0x1
|
||||
#define APA102_NUMBER 1
|
||||
|
||||
// For dotstart set to max for colour information is not masked off
|
||||
#define BOARD_RGB_BRIGHTNESS 0xffffffff
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Yihui Xiong for Makerdiary
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _T1000_E_H
|
||||
#define _T1000_E_H
|
||||
|
||||
#define _PINNUM(port, pin) ((port)*32 + (pin))
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* LED
|
||||
*------------------------------------------------------------------*/
|
||||
#define LEDS_NUMBER 1
|
||||
#define LED_PRIMARY_PIN _PINNUM(0, 24) // Green
|
||||
#define LED_STATE_ON 0
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* BUTTON
|
||||
*------------------------------------------------------------------*/
|
||||
#define BUTTONS_NUMBER 2
|
||||
#define BUTTON_1 _PINNUM(0, 6) // Primary Button
|
||||
#define BUTTON_2 _PINNUM(0, 18) // unusable: RESET
|
||||
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// BLE OTA
|
||||
//--------------------------------------------------------------------+
|
||||
#define BLEDIS_MANUFACTURER "Seeed Studio"
|
||||
#define BLEDIS_MODEL "T1000-E"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USB
|
||||
//--------------------------------------------------------------------+
|
||||
#define USB_DESC_VID 0x2886
|
||||
#define USB_DESC_UF2_PID 0x0057
|
||||
#define USB_DESC_CDC_ONLY_PID 0x0057
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// UF2
|
||||
//--------------------------------------------------------------------+
|
||||
#define UF2_PRODUCT_NAME "Seeed T1000-E for Meshtastic"
|
||||
#define UF2_VOLUME_LABEL "T1000-E"
|
||||
#define UF2_BOARD_ID "nRF52840-T1000-E-v1"
|
||||
#define UF2_INDEX_URL "https://www.seeedstudio.com/SenseCAP-Card-Tracker-T1000-E-for-Meshtastic-p-5913.html"
|
||||
|
||||
|
||||
#endif /* _T1000_E_H */
|
||||
@@ -0,0 +1,3 @@
|
||||
MCU_SUB_VARIANT = nrf52840
|
||||
SD_VERSION = 7.3.0
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "boards.h"
|
||||
#include "uf2/configkeys.h"
|
||||
|
||||
__attribute__((used, section(".bootloaderConfig")))
|
||||
const uint32_t bootloaderConfig[] =
|
||||
{
|
||||
/* CF2 START */
|
||||
CFG_MAGIC0, CFG_MAGIC1, // magic
|
||||
5, 100, // used entries, total entries
|
||||
|
||||
204, 0x100000, // FLASH_BYTES = 0x100000
|
||||
205, 0x40000, // RAM_BYTES = 0x40000
|
||||
208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2
|
||||
209, 0xada52840, // UF2_FAMILY = 0xada52840
|
||||
210, 0x20, // PINS_PORT_SIZE = PA_32
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0
|
||||
/* CF2 END */
|
||||
};
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#define NRFX_PRS_ENABLED 0
|
||||
|
||||
// PWM
|
||||
#define NRFX_PWM_ENABLED 0
|
||||
#define NRFX_PWM0_ENABLED 0
|
||||
#define NRFX_PWM1_ENABLED 0
|
||||
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef NRFX_LOG_H__
|
||||
#define NRFX_LOG_H__
|
||||
|
||||
// THIS IS A TEMPLATE FILE.
|
||||
// It should be copied to a suitable location within the host environment into
|
||||
// which nrfx is integrated, and the following macros should be provided with
|
||||
// appropriate implementations.
|
||||
// And this comment should be removed from the customized file.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup nrfx_log nrfx_log.h
|
||||
* @{
|
||||
* @ingroup nrfx
|
||||
*
|
||||
* @brief This file contains macros that should be implemented according to
|
||||
* the needs of the host environment into which @em nrfx is integrated.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a message with the severity level ERROR.
|
||||
*
|
||||
* @param format printf-style format string, optionally followed by arguments
|
||||
* to be formatted and inserted in the resulting string.
|
||||
*/
|
||||
#define NRFX_LOG_ERROR(format, ...)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a message with the severity level WARNING.
|
||||
*
|
||||
* @param format printf-style format string, optionally followed by arguments
|
||||
* to be formatted and inserted in the resulting string.
|
||||
*/
|
||||
#define NRFX_LOG_WARNING(format, ...)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a message with the severity level INFO.
|
||||
*
|
||||
* @param format printf-style format string, optionally followed by arguments
|
||||
* to be formatted and inserted in the resulting string.
|
||||
*/
|
||||
#define NRFX_LOG_INFO(format, ...)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a message with the severity level DEBUG.
|
||||
*
|
||||
* @param format printf-style format string, optionally followed by arguments
|
||||
* to be formatted and inserted in the resulting string.
|
||||
*/
|
||||
#define NRFX_LOG_DEBUG(format, ...)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a memory dump with the severity level ERROR.
|
||||
*
|
||||
* @param[in] p_memory Pointer to the memory region to be dumped.
|
||||
* @param[in] length Length of the memory region in bytes.
|
||||
*/
|
||||
#define NRFX_LOG_HEXDUMP_ERROR(p_memory, length)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a memory dump with the severity level WARNING.
|
||||
*
|
||||
* @param[in] p_memory Pointer to the memory region to be dumped.
|
||||
* @param[in] length Length of the memory region in bytes.
|
||||
*/
|
||||
#define NRFX_LOG_HEXDUMP_WARNING(p_memory, length)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a memory dump with the severity level INFO.
|
||||
*
|
||||
* @param[in] p_memory Pointer to the memory region to be dumped.
|
||||
* @param[in] length Length of the memory region in bytes.
|
||||
*/
|
||||
#define NRFX_LOG_HEXDUMP_INFO(p_memory, length)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a memory dump with the severity level DEBUG.
|
||||
*
|
||||
* @param[in] p_memory Pointer to the memory region to be dumped.
|
||||
* @param[in] length Length of the memory region in bytes.
|
||||
*/
|
||||
#define NRFX_LOG_HEXDUMP_DEBUG(p_memory, length)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Macro for getting the textual representation of a given error code.
|
||||
*
|
||||
* @param[in] error_code Error code.
|
||||
*
|
||||
* @return String containing the textual representation of the error code.
|
||||
*/
|
||||
#define NRFX_LOG_ERROR_STRING_GET(error_code)
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRFX_LOG_H__
|
||||
Reference in new issue
Block a user