I was able to build manually pulling via git, and adding the following macros in my custom BSP:

   /* BOOT_SERIAL pins */
   /* DFU pin is set to 0.07 on the BLEFRIEND32 */
   #define BOOT_SERIAL_DETECT_PIN      (7)
   /* 0 = No pullup, 1 = Pull Up, 2 = Pull Down */
   #define BOOT_SERIAL_DETECT_PIN_CFG  (0)
   /* Board has external pullup and the tact switch sets the pin to GND */
   #define BOOT_SERIAL_DETECT_PIN_VAL  (0)

This corresponds to the HW bootloader pin on this board: https://cdn-learn.adafruit.com/assets/assets/000/024/297/original/adafruit_products_schem.png?1428267509

Even with the new nrf51_bootser target set to optimized, though, it's running over the .text region limit for the nRF51:

   Error:
   
/Users/ktown/prog/gcc-arm-none-eabi-4_9-2015q1/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld:
   
/Users/ktown/Dropbox/microBuilder/code/nRF52/Mynewt/bletest/bin/nrf51_bootser/apps/boot/boot.elf
   section `.text' will not fit in region `FLASH'
   
/Users/ktown/prog/gcc-arm-none-eabi-4_9-2015q1/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld:
   region `FLASH' overflowed by 1288 bytes
   
/Users/ktown/Dropbox/microBuilder/code/nRF52/Mynewt/bletest/bin/nrf51_bootser/libs/os/os.a(os_arch_arm.o):
   In function `os_arch_os_init':
   
/Users/ktown/Dropbox/microBuilder/Code/nRF52/Mynewt/bletest/repos/apache-mynewt-core/libs/os/src/arch/cortex_m0/os_arch_arm.c:218:
   undefined reference to `bsp_init'

There do tend to be meaningful gains in optimisation between releases, so I switched to 2016q1 (5.3.1) and it's closer, but still not quite small enough:

   Linking boot.elf
   Error:
   
/Users/ktown/prog/gcc-arm-none-eabi-5_3-2016q1/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/bin/ld:
   
/Users/ktown/Dropbox/microBuilder/code/nRF52/Mynewt/bletest/bin/nrf51_bootser/apps/boot/boot.elf
   section `.text' will not fit in region `FLASH'
   
/Users/ktown/prog/gcc-arm-none-eabi-5_3-2016q1/bin/../lib/gcc/arm-none-eabi/5.3.1/../../../../arm-none-eabi/bin/ld:
   region `FLASH' overflowed by 700 bytes
   
/Users/ktown/Dropbox/microBuilder/code/nRF52/Mynewt/bletest/bin/nrf51_bootser/libs/os/os.a(os_arch_arm.o):
   In function `os_arch_os_init':
   
/Users/ktown/Dropbox/microBuilder/Code/nRF52/Mynewt/bletest/repos/apache-mynewt-core/libs/os/src/arch/cortex_m0/os_arch_arm.c:218:
   undefined reference to `bsp_init'
   collect2: error: ld returned 1 exit status

Looking at what 'optimized' gets converted to, it seems like it's '-Os' which is the best we'll get for size (compiler.yml states: "compiler.flags.optimized: [compiler.flags.default, -Os -ggdb]")

Which version of GCC were you using yourself?

Best regards,
Kevin

On 18/06/16 01:44, marko kiiskila wrote:
Hi,

I checked in a package that can be included in bootloader, and
it will accept image upgrades over serial port.

It expects that the image upgrade is done using the newtmgr
protocol. Command set that it supports is limited; it can list images,
accept an image upload command (stores it to slot 0), and also reset.

For testing, I added a snippet of code to apps/boot which can
be conditionally compiled in by defining target features for boot loader
to include BOOT_SERIAL.
The code monitors a GPIO pin, and if it’s set to specific state during
bootup, it’ll enter the serial downloader, awaiting these commands.
Again for testing, I added the pin config to use for Arduino MKR1000
BSP.

Here’s my target definition for using this, in case you want to try this
out:
[marko@IsMyLaptop:~/src/incubator-mynewt-blinky]$ newt target show boot_mkr1000
targets/boot_mkr1000
     app=@apache-mynewt-core/apps/boot
     bsp=@mynewt-arduino-zero/hw/bsp/arduino_mkr1000
     build_profile=optimized
     features=BOOT_SERIAL

Feedback appreciated,
M

On Jun 17, 2016, at 4:26 PM, [email protected] wrote:

boot; conditionally check whether to expect image download commands
over serial. Whether code gets built in depends on target features.



Reply via email to