Re: DA1469x board support

2019-08-06 Thread Dr. Juergen Kienhoefer
Thank you for your help. So far so good, it seemed to work.
Here are my steps loading the boot loader.
Will continue with the app later. My plan is to build the blemesh app from
Nimble on this board.

pip3 install click cryptography


newt new NewtBLE

cd NewtBLE/


add external repositories to project.yml

repository.juullabs-oss-mcuboot:

type: github

vers: 1-latest

user: JuulLabs-OSS

repo: mcuboot




Bootloader

newt target create da1469x_boot

newt target set da1469x_boot app=@mcuboot/boot/mynewt

newt target set da1469x_boot
bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro

newt target set da1469x_boot build_profile=optimized


newt target create da1469x_flash_loader

newt garget set da1469x_flash_loader
app=@apache-mynewt-core/apps/flash_loader

newt target set da1469x_flash_loader
bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro

newt target set da1469x_flash_loader build_profile=optimized

newt target set da1469x_flash_loader
syscfg=FLASH_LOADER_DL_SZ=0x1:RAM_RESIDENT=1

newt install


newt build da1469x_boot

newt build da1469x_flash_loader


newt load da1469x_boot


Loading bootloader



On Tue, Aug 6, 2019 at 4:52 PM Andrzej Kaczmarek <
andrzej.kaczma...@codecoup.pl> wrote:

> Hi,
>
> On Wed, Aug 7, 2019 at 1:17 AM Dr. Juergen Kienhoefer <
> juer...@aircable.net>
> wrote:
>
> > @mkiiskila: Thanks for providing the DA1469x board support.
> > I'm putting together a tutorial how to get Newt working on these boards
> > with Nimble.
> > So far I gathered these bits of information. Apparently, it's not quite
> > enough.
> > Please help me getting it complete:
> >
> 
>
> > FLASH LOADER
> >
> > newt target create da1469x_flash_loader
> >
> > newt target set da1469x_flash_loader
> > app=@apache-mynewt-core/apps/flash_loader
> >
> > newt target set da1469x_flash_loader
> > bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
> >
> > newt target set da1469x_flash_loader build_profile=optimized
> >
> > newt target set da1469x_flash_loader
> > syscfg=FLASH_LOADER_DL_SZ=0x1:RAM_RESIDENT=1
> >
> >
> > APP
> >
> > newt target create da1469x_blinky
> >
> > newt target set da1469x_blinky app=apps/blinky
> >
> > newt target set da1469x_blinky
> > bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
> >
> > newt target set da1469x_blinky build_profile=debug
> >
> >
> > LOAD FLASHLOADER
> >
> > >>>  must run "newt run da1469x_blinky" first to create flash_loader.img,
> > then load it
> >
> > newt load da1469x_flash_loader
> >
>
> This is not how it works. You need 3 targets: flash_loader, bootloader and
> app. What you are missing is a bootloader:
> newt target create da1469_boot
> newt target set da1469x_boot app=@mcuboot/boot/mynewt
> newt target set da1469x_boot
> bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
> newt target set da1469x_boot build_profile=optimized
>
> You need to load bootloader and app to flash and this is where flash_loader
> is used, i.e. you do not load flash_loader, but download script requires it
> to be able to load app and bootloader to flash. The easiest way to do this
> is:
> newt load da1469x_boot
> newt create-image da1469x_blinky 1.0.0
> newt load da1469x_blinky
>
> "newt run da1469x_blinky 1.0.0" will create image for app and load it and
> then start debugging session (as with newt debug) so can be used as a
> shortcut for app, but bootloader needs to be loaded separately.
> Also to load bootloader you will need Python 3.7 (3.6 or older won't work)
> installed because part of bootloader download script which creates product
> header is written in Python. Without proper product header internal
> bootloader won't boot our bootloader (mcuboot) and app won't start.
>
> Once you load both bootloader and app, it should boot properly.
>
> Best,
> Andrzej
>


Re: DA1469x board support

2019-08-06 Thread Andrzej Kaczmarek
Hi,

On Wed, Aug 7, 2019 at 1:17 AM Dr. Juergen Kienhoefer 
wrote:

> @mkiiskila: Thanks for providing the DA1469x board support.
> I'm putting together a tutorial how to get Newt working on these boards
> with Nimble.
> So far I gathered these bits of information. Apparently, it's not quite
> enough.
> Please help me getting it complete:
>


> FLASH LOADER
>
> newt target create da1469x_flash_loader
>
> newt target set da1469x_flash_loader
> app=@apache-mynewt-core/apps/flash_loader
>
> newt target set da1469x_flash_loader
> bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
>
> newt target set da1469x_flash_loader build_profile=optimized
>
> newt target set da1469x_flash_loader
> syscfg=FLASH_LOADER_DL_SZ=0x1:RAM_RESIDENT=1
>
>
> APP
>
> newt target create da1469x_blinky
>
> newt target set da1469x_blinky app=apps/blinky
>
> newt target set da1469x_blinky
> bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
>
> newt target set da1469x_blinky build_profile=debug
>
>
> LOAD FLASHLOADER
>
> >>>  must run "newt run da1469x_blinky" first to create flash_loader.img,
> then load it
>
> newt load da1469x_flash_loader
>

This is not how it works. You need 3 targets: flash_loader, bootloader and
app. What you are missing is a bootloader:
newt target create da1469_boot
newt target set da1469x_boot app=@mcuboot/boot/mynewt
newt target set da1469x_boot
bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
newt target set da1469x_boot build_profile=optimized

You need to load bootloader and app to flash and this is where flash_loader
is used, i.e. you do not load flash_loader, but download script requires it
to be able to load app and bootloader to flash. The easiest way to do this
is:
newt load da1469x_boot
newt create-image da1469x_blinky 1.0.0
newt load da1469x_blinky

"newt run da1469x_blinky 1.0.0" will create image for app and load it and
then start debugging session (as with newt debug) so can be used as a
shortcut for app, but bootloader needs to be loaded separately.
Also to load bootloader you will need Python 3.7 (3.6 or older won't work)
installed because part of bootloader download script which creates product
header is written in Python. Without proper product header internal
bootloader won't boot our bootloader (mcuboot) and app won't start.

Once you load both bootloader and app, it should boot properly.

Best,
Andrzej


Re: newest BSP on OSX

2019-08-06 Thread Dr. Juergen Kienhoefer
thanks Chris
@utzig: the mcuboot app part worked to build the tools.
Here is what I did, adjusting the tutorial
https://mynewt.apache.org/latest/tutorials/blinky/arduino_zero.html


newt target create arduino_boot

newt target set arduino_boot bsp=@mynewt_arduino_zero/hw/bsp/arduino_zero

newt target set arduino_boot app=@mcuboot/boot/mynewt

newt target set arduino_boot build_profile=optimized

newt target set arduino_boot syscfg=BSP_ARDUINO_ZERO=1


newt target create arduino_blinky

newt target set arduino_blinky app=apps/blinky

newt target set arduino_blinky bsp=@mynewt_arduino_zero/hw/bsp/arduino_zero

newt target set arduino_blinky build_profile=debug

newt target set arduino_blinky syscfg=BSP_ARDUINO_ZERO=1

Then to get the app running I follow these instructions
https://cdn-learn.adafruit.com/downloads/pdf/debugging-the-samd21-with-gdb.pdf

Since I have a Jlink, I start the JLINK server:

JLinkGDBServer -if SWD -device ATSAMD21E18


Run GDB

arm-none-eabi-gdb-py

(gdb) target extended-remote :2331


(gdb) load bin/targets/arduino_boot/app/boot/mynewt/mynewt.elf

Loading section .text, size 0x41fc lma 0x0

Loading section .ARM.exidx, size 0x18 lma 0x41fc

Loading section .relocate, size 0x28 lma 0x4214

Start address 0xb8, load size 16956

Transfer rate: 2069 KB/sec, 4239 bytes/write.


(gdb) load bin/targets/arduino_blinky/app/apps/blinky/blinky.elf

Loading section .text, size 0x42a0 lma 0xc020

Loading section .ARM.exidx, size 0x18 lma 0x102c0

Loading section .relocate, size 0x38 lma 0x102d8

Start address 0xc0d8, load size 17136

Transfer rate: 16734 KB/sec, 4284 bytes/write.

But I just can't seem to run the newt build apps.
Any help?

On Tue, Aug 6, 2019 at 1:50 PM Christopher Collins  wrote:

> On Mon, Aug 05, 2019 at 02:13:54PM -0700, Christopher Collins wrote:
> > I am not sure how the brew distribution gets updated, but it looks
> > like we have fallen behind here.  I will look into getting this
> > updated today.
>
> FYI- I have updated brew with newt and newtmgr 1.7.
>
> Chris
>


DA1469x board support

2019-08-06 Thread Dr. Juergen Kienhoefer
@mkiiskila: Thanks for providing the DA1469x board support.
I'm putting together a tutorial how to get Newt working on these boards
with Nimble.
So far I gathered these bits of information. Apparently, it's not quite
enough.
Please help me getting it complete:

PREREQ

(not longer required) install NEWT manually (version 1.7 required), copy
binary to /usr/local/bin

(not longer required) http://apache.cs.utah.edu/mynewt/apache-mynewt-1.7.0/

(officially) brew tap JuulLabs-OSS/mynewt; brew update; brew install
mynewt-newt

install ARM toolchain:

https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

install OpenOCD

https://github.com/gnu-mcu-eclipse/openocd/releases


export PATH


create project

newt new NewtBLE

cd NewtBLE/


TRANSPORT

Dialog DA14695 dev kit

Nimble transport

https://github.com/apache/mynewt-nimble/tree/master/nimble/transport/da1469x


In order to use integrated BLE Controller (CMAC) on DA1469x you will need

a binary firmware to be loaded to CMAC. Library containing such firmware can

be found in SDK package available at:

https://www.dialog-semiconductor.com/products/da1469x-product-family


Copy sdk/interfaces/ble/binaries/DA1469x-Release/libble_stack_da1469x.a file

to src/ subdirectory and rebuild you application.


cp libble_stack_da1469x.a
repos/apache-mynewt-nimble/nimble/transport/da1469x/src

FLASH LOADER

newt target create da1469x_flash_loader

newt target set da1469x_flash_loader
app=@apache-mynewt-core/apps/flash_loader

newt target set da1469x_flash_loader
bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro

newt target set da1469x_flash_loader build_profile=optimized

newt target set da1469x_flash_loader
syscfg=FLASH_LOADER_DL_SZ=0x1:RAM_RESIDENT=1


APP

newt target create da1469x_blinky

newt target set da1469x_blinky app=apps/blinky

newt target set da1469x_blinky
bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro

newt target set da1469x_blinky build_profile=debug


LOAD FLASHLOADER

>>>  must run "newt run da1469x_blinky" first to create flash_loader.img,
then load it

newt load da1469x_flash_loader


RUN

newt run da1469x_blinky 0

App image successfully generated:
/Users/juergen/wirelesscables/ESP/atag/firmware/NewtBlinky/bin/targets/da1469x_blinky/app/apps/blinky/blinky.img

Loading app image into slot 1

[/Users/juergen/wirelesscables/ESP/atag/firmware/NewtBlinky/repos/apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro/dialog_da1469x-dk-pro_debug.sh
/Users/juergen/wirelesscables/ESP/atag/firmware/NewtBlinky/repos/apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
bin/targets/da1469x_blinky/app/apps/blinky/blinky]


Debugging bin/targets/da1469x_blinky/app/apps/blinky/blinky.elf

*GNU gdb (GNU Tools for Arm Embedded Processors 8-2019-q3-update)
8.3.0.20190703-git*

Copyright (C) 2019 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later 

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Type "show copying" and "show warranty" for details.

This GDB was configured as "--host=x86_64-apple-darwin10
--target=arm-none-eabi".

Type "show configuration" for configuration details.

For bug reporting instructions, please see:

.

Find the GDB manual and other documentation resources online at:

.


For help, type "help".

Type "apropos word" to search for commands related to "word"...

Reading symbols from bin/targets/da1469x_blinky/app/apps/blinky/blinky.elf
...

0x2d04 in g_os_main_stack ()

Resetting target

0x2262 in da1469x_m33_sleep_state ()

(gdb) c

Continuing.


Program received signal SIGTRAP, Trace/breakpoint trap.

0xdeadbeee in ?? ()

(gdb)


Re: newest BSP on OSX

2019-08-06 Thread Christopher Collins
On Mon, Aug 05, 2019 at 02:13:54PM -0700, Christopher Collins wrote:
> I am not sure how the brew distribution gets updated, but it looks
> like we have fallen behind here.  I will look into getting this
> updated today.

FYI- I have updated brew with newt and newtmgr 1.7.

Chris


Re: newest BSP on OSX

2019-08-06 Thread Fabio Utzig
On Tue, Aug 6, 2019, at 2:45 PM, Dr. Juergen Kienhoefer wrote:

> The app/boot was removed after version 1.6.0
> Is there a replacement for that now? A change of the core version number in
> project.yml did not help.
> The error still is:
> Error: Could not resolve app package: @apache-mynewt-core/apps/boot

For "1.7.0" or "master" it should be: "@mcuboot/boot/mynewt"


Re: newest BSP on OSX

2019-08-06 Thread Dr. Juergen Kienhoefer
Hi Chris,
Still having issues with the versions. Running through the tutorials I
noticed that some files have changed.
I tried this:
https://mynewt.apache.org/latest/tutorials/blinky/arduino_zero.html
The app/boot was removed after version 1.6.0
Is there a replacement for that now? A change of the core version number in
project.yml did not help.
The error still is:
Error: Could not resolve app package: @apache-mynewt-core/apps/boot

On Mon, Aug 5, 2019 at 3:10 PM Dr. Juergen Kienhoefer 
wrote:

> Thank you very much, that did it. On MacOS this gets only the old 1.5.0
> version with no way to upgrade to 1.7.0
>
> $ brew tap JuulLabs-OSS/mynewt
> $ brew install mynewt-newt
>
>
> Installing the newt binary from your link got the latest 1.7.0 version and
> I was able to upgrade and build an example for the Dialog chip.
> Cheers
>
>
> On Mon, Aug 5, 2019 at 2:12 PM Christopher Collins 
> wrote:
>
>> Hi Juergen,
>>
>> Run the following:
>>
>> newt upgrade && newt sync
>>
>> (instead of `newt install`).  This will download updates for those
>> Mynewt repos.
>>
>> You might also need to upgrade your version of the newt tool.  I am not
>> sure how the brew distribution gets updated, but it looks like we have
>> fallen behind here.  I will look into getting this updated today.  In
>> the meantime, you can download the 1.7.0 macOS binary here:
>> https://www.apache.org/dyn/closer.lua/mynewt/apache-mynewt-1.7.0/
>>
>> (click the top link, then `apache-mynewt-newt-bin-osx-1.7.0.tgz`).
>>
>> Chris
>>
>> On Mon, Aug 05, 2019 at 12:53:08PM -0700, Dr. Juergen Kienhoefer wrote:
>> > Hi, I was wondering how I can get the latest BSP on a MacOS
>> installation.
>> > Installing newt with brew gets version 1.5.0. The bsp is in 1.7.0
>> >
>> > newt install
>> >
>> > Skipping "apache-mynewt-core": already installed (1.5.0)
>> >
>> > Skipping "mcuboot": already installed (0.0.0)
>> >
>> > Skipping "apache-mynewt-nimble": already installed (1.0.0)
>> >
>> > Skipping "mynewt_arduino_zero": already installed (0.0.0)
>> >
>> >
>> > then
>> >
>> >
>> > newt target set mytarget
>> > bsp=@apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
>> >
>> > newt build mytarget
>> >
>> >
>> > gets me that error:
>> >
>> > Error: Could not resolve BSP package:
>> > @apache-mynewt-core/hw/bsp/dialog_da1469x-dk-pro
>> >
>> >
>> > my project file:
>> >
>> > repository.apache-mynewt-core:
>> >
>> > type: github
>> >
>> > vers: 1-latest
>> >
>> > user: apache
>> >
>> > repo: mynewt-core
>> >
>> >
>> > Still does not give me that BSP.
>> >
>> >
>> > Any suggestions would be appreciated.
>>
>