This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Define BOARD_CUSTOM not working in SDK12 with GCC

I can't seem to add custom pin definitions to my own board in SDK12. I use the BOARD_CUSTOM define and copied my PCA10040 header file to one call custom_board.h and my pin assignments do not change. The only warnings I get are from bad paths to the config folder which is new since moving to SDK12.image description

Parents
  • If you are using gcc and the makefile, the definition for the board is set inside the makefile and not using a #define in a header

    The SDK is slightly misleading, as it applies to all build platforms e.g. Keil and IAR as well as gcc, and each of them will have a different way to add the define.

    If you add

    #define BOARD_CUSTOM  
    

    To a header that is included by the whole project, this will cause a problem, as the define for the PCA board will still be defined in the makefile.

    the

    -DXXX
    

    flag for the gcc compiler (preprocessor) is the same as

    #define XXX
    

    So, you need to change the lines in the makefile which have

    -DBOARD_PCA10040
    

    to

    -DBOARD_CUSTOM
    

    This occurs in 2 places, once for the CFLAGS and once for the ASMFLAGS

  • Chris

    I don't use Keil, but I do have the demo installed, and if you look in the project options under C/C++ and also under ASM, you can define Preprocessor Symbols

    I think that would be where you'd need to define BOARD_CUSTOM

    I don't have IAR, but if you look in blinky_pca10040.ewp in the iar folder you'll see

    <option>
      <name>CCDefines</name>          <state>NRF52832</state>          <state>BOARD_PCA10040</state>
    

    etc

    and the same in

    ADefines

    So.. I agree the documentation is confusing, as they use the term #define BOARD_CUSTOM when in fact they just mean that BOARD_CUSTOM must be defined.

    I think the only way to do this in practice is via a compiler (preprocessor) directive (or the equivalent project settings or options)

Reply
  • Chris

    I don't use Keil, but I do have the demo installed, and if you look in the project options under C/C++ and also under ASM, you can define Preprocessor Symbols

    I think that would be where you'd need to define BOARD_CUSTOM

    I don't have IAR, but if you look in blinky_pca10040.ewp in the iar folder you'll see

    <option>
      <name>CCDefines</name>          <state>NRF52832</state>          <state>BOARD_PCA10040</state>
    

    etc

    and the same in

    ADefines

    So.. I agree the documentation is confusing, as they use the term #define BOARD_CUSTOM when in fact they just mean that BOARD_CUSTOM must be defined.

    I think the only way to do this in practice is via a compiler (preprocessor) directive (or the equivalent project settings or options)

Children
No Data
Related