+1 for new BSP as opposed to #ifdef. Regards, Vipul Rahane
> On Apr 18, 2016, at 2:04 PM, [email protected] wrote: > > I concur with what Chris is saying. This is how we do it for arduino, but > its not ideal in my opinion. > > It worked OK for arduino zero versus Zero Pro, but for your case we are > talking about two very different products (arduino and NRF eval board). > > I wish I had a good answer. One possibility is to pull stuff that is > common across all NRF51 boards into a separate component. > > > > On 4/18/16, 1:02 PM, "Christopher Collins" <[email protected]> wrote: > >> Hi Andre, >> >> On Mon, Apr 18, 2016 at 10:55:49AM +0300, Andrei Emeltchenko wrote: >>> Hi, >>> >>> I am working on arduino_101 development board. >>> https://www.arduino.cc/en/Main/ArduinoBoard101 >>> >>> It has nrf51 BLE chip, Basically the configuration is the same as for >>> the nrf51dk-16kbram with the only difference: >>> >>> --- a/hw/bsp/nrf51dk-16kbram/src/hal_bsp.c >>> +++ b/hw/bsp/nrf51dk-16kbram/src/hal_bsp.c >>> @@ -24,7 +24,7 @@ >>> static const struct nrf51_uart_cfg uart_cfg = { >>> .suc_pin_tx = 9, >>> .suc_pin_rx = 11, >>> - .suc_pin_rts = 8, >>> + .suc_pin_rts = 12, >>> .suc_pin_cts = 10 >>> }; >>> >>> >>> What is the best way of keeping the change? Making special BSP would be >>> too expensive for this one line change. >> >> This is indeed an annoying situation. There is a nearly identical >> dilemma with the Arduino Zero and the Arduino Zero Pro; the only >> difference among these two boards is a single pin. >> >> The solution for the Arduino Zero is to use a single BSP, but to select >> the proper pin at compile time via an #ifdef: >> >> #ifdef ARDUINO_ZERO_PRO >> ARDUINO_ZERO_D2 = (8), >> ARDUINO_ZERO_D4 = (14), >> #endif >> >> #ifdef ARDUINO_ZERO >> ARDUINO_ZERO_D2 = (14), >> ARDUINO_ZERO_D4 = (8), >> #endif >> >> The appropriate preprocessor symbol is defined by the use of a target >> feature, as described in the arduino zero tutorial: >> http://mynewt.apache.org/os/tutorials/arduino_zero/ >> >> That said, I am not sure this is the right approach. I will certainly >> let others weight in, but my feeling is that it is better to just bite >> the bullet and create a new BSP. Both solutions pose maintenance >> headaches, but I think separate BSPs is simpler and more maintainable. >> An additional benefit of separate BSPs is that it simplifies target >> creation for the application developer (just specify BSP, rather than >> BSP plus feature). >> >> Thanks, >> Chris >
