I'm trying to document the process of creating a custom BSP based on an existing model from apache-newt-core, and copied the model into the local `projectroot/hw/bsp/boardname` folder, updated the `pkg.yml` file, and modified the filenames/content accordingly. I then referenced this BSP in the bootloader and main application target via newt.

When I reference the local `hw/bsp/boardname` instance and then try to build I get the following error, though:

   $ newt -v build nrf51_boot
   Building target targets/nrf51_boot
   panic: interface conversion: interfaces.PackageInterface is nil, not
   *pkg.LocalPackage

   goroutine 1 [running]:
   panic(0x4f6b00, 0xc820493680)
        /usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:464 +0x3e6
   mynewt.apache.org/newt/newt/builder.(*Builder).resolveCompiler(0xc82013bc80,
   0xc8201ac3c0)
   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newt/builder/buildutil.go:102
   +0x17c
   mynewt.apache.org/newt/newt/builder.(*Builder).PrepBuild(0xc82013bc80,
   0x0, 0x0)
   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newt/builder/build.go:313
   +0x238
   mynewt.apache.org/newt/newt/builder.(*Builder).Build(0xc82013bc80,
   0x0, 0x0)
   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newt/builder/build.go:413
   +0x8e
   mynewt.apache.org/newt/newt/cli.buildRunCmd(0xc820127a00,
   0xc820105720, 0x1, 0x2)
   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newt/cli/build_cmds.go:76
   +0x5fe
   
mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra.(*Command).execute(0xc820127a00,
   0xc8201055c0, 0x2, 0x2, 0x0, 0x0)
   
/Users/ktown/prog/go/src/mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra/command.go:569
   +0x85a
   
mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc820126000,
   0xc820127a00, 0x0, 0x0)
   
/Users/ktown/prog/go/src/mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra/command.go:656
   +0x55c
   
mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra.(*Command).Execute(0xc820126000,
   0x0, 0x0)
   
/Users/ktown/prog/go/src/mynewt.apache.org/newt/newt/vendor/github.com/spf13/cobra/command.go:615
   +0x2d
   main.main()
   /Users/ktown/prog/go/src/mynewt.apache.org/newt/newt/newt.go:123 +0x70

When I move the `projectroot/hw/bsp/boardname` files in `projectroot/repos/apache-newt-core/hw/bsp/boardname` and then point the targets there, everything builds fine, but I'm not sure what the secret is to having local BSPs outside the main newt repo?

I thought the problem might be the dependency paths in my BSP pkg.yml file but even updating them as shown below throws the same error when trying to build (prepending `aapache-newt-core` to the dependency since the root path changed when the BSP was copied locally):

   pkg.deps:
        - @apache-newt-core/hw/mcu/nordic/nrf51xxx
        - @apache-newt-core/libs/baselibc
   pkg.deps.BLE_DEVICE:
        - @apache-newt-core/net/nimble/drivers/nrf51


Is there a restriction on having local BSP definitions for different board targets, or perhaps I'm just missing something obvious? I can build putting them in the apache-newt-core repo, but that's probably the wrong place for a project-specific BSP or board variant?

Reply via email to