Compare commits

...
24 Commits
Author SHA1 Message Date
hathach 5f5371b9b3 Merge branch 'master' of github.com:adafruit/Adafruit_nRF52_Bootloader 2019-09-25 14:04:51 +07:00
hathach 1d7ca6a1dc update changelog for release 2019-09-25 14:04:07 +07:00
hathach 7691f08ff0 Merge pull request #82 from adafruit/develop
fix #76 and clean up
2019-09-25 13:58:33 +07:00
hathach 5b6488ca70 update build script 2019-09-25 12:54:26 +07:00
hathach 9556f2ace8 follow up to PR #77 2019-09-25 12:17:46 +07:00
hathach ef4d0e7564 Merge branch 'master' into develop 2019-09-25 12:14:38 +07:00
hathach fc00e2b202 Merge pull request #77 from khanning/button-dir-fix
Add check for button direction
2019-09-25 11:55:20 +07:00
Kreg Hanning 8906b2a8bd Add check for button direction 2019-09-09 08:59:31 -04:00
hathach c751975f1d update changelog and readme, ready to relase 0.2.12 2019-08-22 21:57:53 +07:00
hathach c3fc0dba91 Merge branch 'master' into develop 2019-08-22 21:46:34 +07:00
hathach a921f27ee8 Merge pull request #75 from henrygab/patch-1
Fix bug in `__DOSTIME__` macro
2019-08-17 18:55:16 +07:00
Henry Gabryjelski 04290e7bea Fix bug in __DOSTIME__ macro 2019-08-14 12:32:36 -07:00
Ladyada d78322519a this time with correct pins 2019-08-04 21:03:13 -04:00
Ladyada 09daa09a5e initial bootloader def (is using neopix instead of dotstar) 2019-08-04 17:53:16 -04:00
ladyada 661827c166 update to rev C pins 2019-07-13 19:59:09 -04:00
hathach 2c13fd53f4 support 10 neopixel of cplayground 2019-06-17 22:51:38 +07:00
hathach b1029c6ae5 Merge branch 'master' of github.com:adafruit/Adafruit_nRF52_Bootloader into develop 2019-06-17 19:28:10 +07:00
ladyada 95325465cc add draft for cplay nrf52840 2019-06-14 22:18:58 -04:00
hathach 580ae2e7fc Merge pull request #71 from fanoush/patch-1
fix for issue #70
2019-06-05 12:17:13 +07:00
fanoush 4ce961f25b fix block alignment bug also in dfu_sd_image_validate 2019-05-24 13:22:57 +02:00
fanoush 90e3149050 fix block alignment bug also in dfu_sd_image_validate 2019-05-24 13:07:32 +02:00
hathach fb847b942e Update issue templates 2019-05-10 21:24:33 +07:00
hathach dfc3db25c3 Update issue templates 2019-05-10 21:22:08 +07:00
hathach bc40cd7c46 add issue templates 2019-05-10 21:16:57 +07:00
14 changed files with 294 additions and 39 deletions

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: "[Bug]"
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**Set up (please complete the following information)**
- Your Board and BSP version
- Your OS (mac/windows/linux) and its version
- Serial debug log (enable IDE's Debug Mode Level to 1 or 2)
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+2 -1
View File
@@ -6,6 +6,7 @@ This is a CDC/DFU/UF2 bootloader for nRF52 boards.
- [Adafruit Feather nRF52832](https://www.adafruit.com/product/3406)
- [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062)
- [Adafruit Circuit Playground Bluefruit](https://www.adafruit.com/product/4333)
- Adafruit Metro nRF52840 Express
- [Electronut Labs Papyr](https://docs.electronut.in/papyr/)
- MakerDiary MDK nRF52840 USB Dongle
@@ -76,7 +77,7 @@ For other boards, please check the board definition for details.
### Making your own UF2
To create your own UF2 DFU update image, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file or .hex file, specifying the family as **0xADA52840**. Be sure to compile your application to start at 0x26000 (152k). If using a .bin file with the conversion script you must specify this with the -b switch.
To create your own UF2 DFU update image, simply use the [Python conversion script](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py) on a .bin file or .hex file, specifying the family as **0xADA52840**. If using a .bin file with the conversion script you must specify application address with the -b switch, this address depend on the SoftDevice size/version e.g S140 v6 is 0x26000
To create a UF2 image from a .bin file:
```
+11
View File
@@ -1,5 +1,16 @@
# Adafruit nRF52 Bootloader Changelog
## 0.2.13 - 2019.09.25
- Fixed button pulldown with Adafruit Circuit Playground Bluefruit, PR #77 thanks to @khanning
## 0.2.12 - 2019.08.22
- Fixed block alignment bug also in dfu_sd_image_validate (single & dual banks), PR #71 thanks to @fanoush
- Added new board: Adafruit Circuit Playground Bluefruit
- Added new board: Adafruit ItsyBitsy nRF52840 Express (WIP)
- Fixed bug in __DOSTIME__ macro, PR #75 thanks to @henrygab
## 0.2.11
- Fixed various FAT issues, thanks to @henrygab
@@ -817,6 +817,9 @@ uint32_t dfu_sd_image_validate(void)
uint32_t image_end = bootloader_settings.sd_image_start +
bootloader_settings.sd_image_size;
/* ##### FIX START ##### */
block_size &= ~(uint32_t)(CODE_PAGE_SIZE - 1);
/* ##### FIX END ##### */
uint32_t img_block_start = bootloader_settings.sd_image_start + 2 * block_size;
uint32_t sd_block_start = sd_start + 2 * block_size;
@@ -790,6 +790,9 @@ uint32_t dfu_sd_image_validate(void)
uint32_t image_end = bootloader_settings.sd_image_start +
bootloader_settings.sd_image_size;
/* ##### FIX START ##### */
block_size &= ~(uint32_t)(CODE_PAGE_SIZE - 1);
/* ##### FIX END ##### */
uint32_t img_block_start = bootloader_settings.sd_image_start + 2 * block_size;
uint32_t sd_block_start = sd_start + 2 * block_size;
+33 -19
View File
@@ -34,18 +34,28 @@
#define SCHED_QUEUE_SIZE 30 /**< Maximum number of events in the scheduler queue. */
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
void neopixel_init(void);
void neopixel_write(uint8_t *pixels);
void neopixel_teardown(void);
#endif
//------------- IMPLEMENTATION -------------//
void button_init(uint32_t pin)
{
nrf_gpio_cfg_sense_input(pin, BUTTON_PULL, NRF_GPIO_PIN_SENSE_LOW);
if ( BUTTON_PULL == NRF_GPIO_PIN_PULLDOWN )
{
nrf_gpio_cfg_sense_input(pin, BUTTON_PULL, NRF_GPIO_PIN_SENSE_HIGH);
}
else
{
nrf_gpio_cfg_sense_input(pin, BUTTON_PULL, NRF_GPIO_PIN_SENSE_LOW);
}
}
bool button_pressed(uint32_t pin)
{
return (nrf_gpio_pin_read(pin) == 0) ? true : false;
uint32_t const active_state = (BUTTON_PULL == NRF_GPIO_PIN_PULLDOWN ? 1 : 0);
return nrf_gpio_pin_read(pin) == active_state;
}
void board_init(void)
@@ -67,9 +77,8 @@ void board_init(void)
led_pwm_init(LED_SECONDARY, LED_SECONDARY_PIN);
#endif
// use neopixel for use enumeration
// use neopixel for use enumeration
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
extern void neopixel_init(void);
neopixel_init();
#endif
@@ -93,7 +102,6 @@ void board_teardown(void)
led_pwm_teardown();
#if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
extern void neopixel_teardown(void);
neopixel_teardown();
#endif
// Button
@@ -297,9 +305,9 @@ void led_state(uint32_t state)
#define MAGIC_T1H 13UL | (0x8000) // 0.8125us
#define CTOPVAL 20UL // 1.25us
#define NEO_NUMBYTE 3
#define BYTE_PER_PIXEL 3
static uint16_t pixels_pattern[NEO_NUMBYTE * 8 + 2];
static uint16_t pixels_pattern[NEOPIXELS_NUMBER*BYTE_PER_PIXEL * 8 + 2];
// use PWM1 for neopixel
void neopixel_init(void)
@@ -347,29 +355,35 @@ void neopixel_init(void)
void neopixel_teardown(void)
{
uint8_t grb[3] = { 0, 0, 0 };
uint8_t rgb[3] = { 0, 0, 0 };
NRFX_DELAY_US(50); // wait for previous write is complete
neopixel_write(grb);
neopixel_write(rgb);
NRFX_DELAY_US(50); // wait for this write
pwm_teardown(NRF_PWM1);
}
// write 3 bytes color to a built-in neopixel
// write 3 bytes color RGB to built-in neopixel
void neopixel_write (uint8_t *pixels)
{
uint8_t grb[NEO_NUMBYTE] = {pixels[1], pixels[2], pixels[0]};
// convert RGB to GRB
uint8_t grb[BYTE_PER_PIXEL] = {pixels[1], pixels[2], pixels[0]};
uint16_t pos = 0; // bit position
for ( uint16_t n = 0; n < NEO_NUMBYTE; n++ )
{
uint8_t pix = grb[n];
for ( uint8_t mask = 0x80; mask > 0; mask >>= 1 )
// Set all neopixel to same value
for (uint16_t n = 0; n < NEOPIXELS_NUMBER; n++ )
{
for(uint8_t c = 0; c < BYTE_PER_PIXEL; c++)
{
pixels_pattern[pos] = (pix & mask) ? MAGIC_T1H : MAGIC_T0H;
pos++;
uint8_t const pix = grb[c];
for ( uint8_t mask = 0x80; mask > 0; mask >>= 1 )
{
pixels_pattern[pos] = (pix & mask) ? MAGIC_T1H : MAGIC_T0H;
pos++;
}
}
}
@@ -409,8 +423,8 @@ void neopixel_init(void)
void neopixel_teardown(void)
{
uint8_t grb[3] = { 0, 0, 0 };
neopixel_write(grb);
uint8_t rgb[3] = { 0, 0, 0 };
neopixel_write(rgb);
nrf_gpio_cfg_default(LED_RGB_RED_PIN);
nrf_gpio_cfg_default(LED_RGB_GREEN_PIN);
nrf_gpio_cfg_default(LED_RGB_BLUE_PIN);
+1
View File
@@ -35,6 +35,7 @@
#ifndef BUTTON_DFU
#define BUTTON_DFU BUTTON_1
#endif
#ifndef BUTTON_FRESET
#define BUTTON_FRESET BUTTON_2
#endif
@@ -0,0 +1,75 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2018 Ha Thach for Adafruit Industries
*
* 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 _CPLAY_NRF52840_H
#define _CPLAY_NRF52840_H
#define _PINNUM(port, pin) ((port)*32 + (pin))
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 14)
#define LED_STATE_ON 1
#define LED_NEOPIXEL _PINNUM(0, 13)
#define NEOPIXELS_NUMBER 10
#define BOARD_RGB_BRIGHTNESS 0x040404
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 _PINNUM(1, 02) // left button
#define BUTTON_2 _PINNUM(1, 15) // right button
#define BUTTON_PULL NRF_GPIO_PIN_PULLDOWN
/*------------------------------------------------------------------*/
/* UART
*------------------------------------------------------------------*/
#define RX_PIN_NUMBER _PINNUM(0, 30)
#define TX_PIN_NUMBER _PINNUM(0, 14)
#define CTS_PIN_NUMBER 0
#define RTS_PIN_NUMBER 0
#define HWFC false
// Used as model string in OTA mode
#define BLEDIS_MANUFACTURER "Adafruit Industries"
#define BLEDIS_MODEL "Circuit Playground nRF52840"
//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x0045
#define USB_DESC_CDC_ONLY_PID 0x0045
//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "Adafruit Circuit Playground nRF52840"
#define UF2_VOLUME_LABEL "CPLAYBTBOOT"
#define UF2_BOARD_ID "nRF52840-CircuitPlayground-revD"
#define UF2_INDEX_URL "https://www.adafruit.com/product/4300"
#endif // _CPLAY_NRF52840_H
+4 -2
View File
@@ -33,10 +33,12 @@
#define LEDS_NUMBER 2
#define LED_PRIMARY_PIN _PINNUM(1, 15)
#define LED_SECONDARY_PIN _PINNUM(1, 10)
#define LED_NEOPIXEL 16
#define BOARD_RGB_BRIGHTNESS 0x040404
#define LED_STATE_ON 1
#define LED_NEOPIXEL _PINNUM(0, 16)
#define NEOPIXELS_NUMBER 1
#define BOARD_RGB_BRIGHTNESS 0x040404
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
@@ -0,0 +1,75 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2018 Ha Thach for Adafruit Industries
*
* 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 _ITSYBITSY_NRF52840_H
#define _ITSYBITSY_NRF52840_H
#define _PINNUM(port, pin) ((port)*32 + (pin))
/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 1
#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
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 _PINNUM(0, 29) // user switch
#define BUTTON_2 _PINNUM(1, 02) // D2 breakout
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
/*------------------------------------------------------------------*/
/* UART
*------------------------------------------------------------------*/
#define RX_PIN_NUMBER _PINNUM(0, 25)
#define TX_PIN_NUMBER _PINNUM(0, 24)
#define CTS_PIN_NUMBER 0
#define RTS_PIN_NUMBER 0
#define HWFC false
// Used as model string in OTA mode
#define BLEDIS_MANUFACTURER "Adafruit Industries"
#define BLEDIS_MODEL "ItsyBitsy nRF52840 Express"
//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x0051
#define USB_DESC_CDC_ONLY_PID 0x0052
//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "Adafruit ItsyBitsy nRF52840 Express"
#define UF2_VOLUME_LABEL "ITSY840BOOT"
#define UF2_BOARD_ID "nRF52840-ItsyBitsy-revA"
#define UF2_INDEX_URL "https://www.adafruit.com/"
#endif // _ITSY_NRF52840_H
+4 -2
View File
@@ -33,10 +33,12 @@
#define LEDS_NUMBER 2
#define LED_PRIMARY_PIN _PINNUM(1, 13)
#define LED_SECONDARY_PIN _PINNUM(1, 15)
#define LED_NEOPIXEL _PINNUM(0, 13)
#define BOARD_RGB_BRIGHTNESS 0x040404
#define LED_STATE_ON 1
#define LED_NEOPIXEL _PINNUM(0, 13)
#define NEOPIXELS_NUMBER 1
#define BOARD_RGB_BRIGHTNESS 0x040404
/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
+8 -8
View File
@@ -43,10 +43,10 @@ SOFTWARE.
: (__DATE__ [2u] == 'y' ) ? 5u /*May*/ \
: (__DATE__ [2u] == 'n' ) ? 6u /*Jun*/ \
: (__DATE__ [2u] == 'l' ) ? 7u /*Jul*/ \
: (__DATE__ [2u] == 'g' ) ? 8u /*Jul*/ \
: (__DATE__ [2u] == 'p' ) ? 9u /*Jul*/ \
: (__DATE__ [2u] == 't' ) ? 10u /*Jul*/ \
: (__DATE__ [2u] == 'v' ) ? 11u /*Jul*/ \
: (__DATE__ [2u] == 'g' ) ? 8u /*Aug*/ \
: (__DATE__ [2u] == 'p' ) ? 9u /*Sep*/ \
: (__DATE__ [2u] == 't' ) ? 10u /*Oct*/ \
: (__DATE__ [2u] == 'v' ) ? 11u /*Nov*/ \
: 12u /*Dec*/ )
#define __DAY_INT__ ( \
@@ -71,12 +71,12 @@ SOFTWARE.
#define __DOSDATE__ ( \
((__YEAR_INT__ - 1980u) << 9u) | \
( __MONTH_INT__ << 5u) | \
( __DAY_INT__ << 0u) )
( __DAY_INT__ << 0u) )
#define __DOSTIME__ ( \
( __HOUR_INT__ << 11u) | \
( __MONTH_INT__ << 5u) | \
( __DAY_INT__ << 0u) )
( __HOUR_INT__ << 11u) | \
( __MINUTE_INT__ << 5u) | \
( __SECONDS_INT__ << 0u) )
#endif // COMPILE_DATE_H
+23 -7
View File
@@ -11,8 +11,13 @@ travis = False
if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
travis = True
success_count = 0
fail_count = 0
exit_status = 0
build_format = '| {:30} | {:9} '
build_separator = '-' * 54
all_boards = []
for entry in os.scandir("src/boards"):
all_boards.append(entry.name)
@@ -21,6 +26,10 @@ for entry in os.scandir("src/boards"):
total_time = time.monotonic()
print(build_separator)
print((build_format + '| {:5} |').format('Board', 'Result', 'Time'))
print(build_separator)
for board in all_boards:
bin_directory = "bin/{}/".format(board)
os.makedirs(bin_directory, exist_ok=True)
@@ -28,10 +37,14 @@ for board in all_boards:
start_time = time.monotonic()
make_result = subprocess.run("make -j 4 BOARD={} combinehex genpkg".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
build_duration = time.monotonic() - start_time
success = "\033[32msucceeded\033[0m"
if make_result.returncode != 0:
if make_result.returncode == 0:
success = "\033[32msucceeded\033[0m"
success_count += 1
else:
exit_status = make_result.returncode
success = "\033[31mfailed\033[0m"
success = "\033[31mfailed\033[0m "
fail_count += 1
for entry in os.scandir("_build-{}".format(board)):
for extension in ["zip", "hex"]:
@@ -40,15 +53,18 @@ for board in all_boards:
if travis:
print('travis_fold:start:build-{}\\r'.format(board))
print("Build {} took {:.2f}s and {}".format(board, build_duration, success))
print((build_format + '| {:.2f}s |').format(board, success, build_duration))
if make_result.returncode != 0:
print(make_result.stdout.decode("utf-8"))
if travis:
print('travis_fold:end:build-{}\\r'.format(board))
print()
# Build Summary
total_time = time.monotonic() - total_time
print("Total build time took {:.2f}s".format(total_time))
print(build_separator)
print("Build Sumamary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m and took {:.2f}s".format(success_count, fail_count, total_time))
print(build_separator)
sys.exit(exit_status)