Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert some defines in bsp.h to syscfg settings #499

Merged
merged 3 commits into from
Aug 31, 2017

Conversation

ccollins476ad
Copy link
Contributor

@ccollins476ad ccollins476ad commented Aug 25, 2017

This PR converts a number of #defines in each BSP's bsp.h file to syscfg settings. The motivation for this change was to simplify the bsp.h files for the purposes of documentation. I think this change is also desirable for these reasons:

  1. Reduce code duplication: several of these settings were defined with the same value in each BSP. Now these settings are defined once in one place.

  2. Better modularity: each of these settings are used by a single package. It is better to define the setting in the package that needs it and allow the BSP to override it.

  3. More opportunities to override: syscfg settings can be overridden by the BSP, app, and / or target, unlike #defines.

The following syscfg settings are added:

    NFFS_NUM_AREAS:
        description: >
            Number of areas to allocate in the NFFS disk.  A smaller number is
            used if the flash hardware cannot support this value.
        value: 8

    CONFIG_FCB_NUM_AREAS:
        description: >
            Number of areas to allocate in the config FCB.  A smaller number is
            used if the flash hardware cannot support this value.
        value: 8

    BOOT_SERIAL_DETECT_PIN:
        description: >
            Start the serial boot loader if this pin is asserted at boot time.
        value:
        restrictions:
            - '$notnull'

    BOOT_SERIAL_DETECT_PIN_CFG:
        description: >
            GPIO configuration for the serial boot loader detect pin.
        value: 'HAL_GPIO_PULL_UP'

    BOOT_SERIAL_DETECT_PIN_VAL:
        description: >
            The value the detect pin must be set to for the serial boot loader
            to start.
        value: 0

    BOOT_SERIAL_REPORT_PIN:
        description: >
            The GPIO to toggle while the serial boot loader is running.  Set to
            -1 to disable reporting.
        value: 'LED_BLINK_PIN'

    BOOT_SERIAL_REPORT_FREQ:
        description: >
            The toggle rate, in Hz, of the serial boot loader report pin.
        value: 4

This value indicates the number of areas to allocate in the NFFS disk.
Prior to this commit, this number was defined separately in each BSP's
`bsp.h` file.

Now, this `#define` is replaced by a syscfg setting:

```
    NFFS_NUM_AREAS:
        description: >
            Number of areas to allocate in the NFFS disk.  A smaller number is
            used if the flash hardware cannot support this value.
        value: 8
```
    CONFIG_FCB_NUM_AREAS:
        description: >
            Number of areas to allocate in the config FCB.  A smaller number is
            used if the flash hardware cannot support this value.
        value: 8
@ccollins476ad ccollins476ad reopened this Aug 25, 2017
This commit adds the following syscfg settings:

    BOOT_SERIAL_DETECT_PIN:
        description: >
            Start the serial boot loader if this pin is asserted at boot time.
        value:
        restrictions:
            - '$notnull'

    BOOT_SERIAL_DETECT_PIN_CFG:
        description: >
            GPIO configuration for the serial boot loader detect pin.
        value: 'HAL_GPIO_PULL_UP'

    BOOT_SERIAL_DETECT_PIN_VAL:
        description: >
            The value the detect pin must be set to for the serial boot loader
            to start.
        value: 0

    BOOT_SERIAL_REPORT_PIN:
        description: >
            The GPIO to toggle while the serial boot loader is running.  Set to
            -1 to disable reporting.
        value: 'LED_BLINK_PIN'

    BOOT_SERIAL_REPORT_FREQ:
        description: >
            The toggle rate, in Hz, of the serial boot loader report pin.
        value: 4
@ccollins476ad ccollins476ad changed the title Remove NFFS_AREA_MAX constant from bsp.h. Convert some defines in bsp.h to syscfg settings Aug 25, 2017
Copy link
Contributor

@mkiiskila mkiiskila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok. This change probably should be reported in dev list, as this will have impact on users who have their own BSPs and using serial bootloader.

@ccollins476ad ccollins476ad merged commit e3c41b9 into apache:master Aug 31, 2017
@ccollins476ad ccollins476ad deleted the rm-nffs-area-max branch August 31, 2017 19:26
ccollins476ad added a commit to runtimeco/mynewt_arduino_zero that referenced this pull request Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants