kconfig


laczenJMS
 

Hi,

I am working on a subsystem and I have some problem with Kconfig. I
would like to define a configuration setting: SET_NVS_SECTOR_SIZE and
apply a default equal to the define FLASH_ERASE_BLOCK_SIZE:

config SET_NVS_SECTOR_SIZE
int "sector size used by default NVS backend"
default FLASH_ERASE_BLOCK_SIZE

but this doen't work: cmake complaints that FLASH_ERASE_BLOCK_SIZE is
not defined. However I can use FLASH_ERASE_BLOCK_SIZE in a .c or .h
file, and its value is set correct.

How should I do this in Kconfig ?

Thanks,

Jehudi


Carles Cufi
 

Hi Jehudi,

Kconfig options can only default to values of other Kconfig options, the whole Kconfig system is self-contained and has no access to macros in the code.
If necessary, you can convert FLASH_ERASE_BLOCK_SIZE to be a Kconfig option perhaps?

Carles

-----Original Message-----
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org> On
Behalf Of laczenJMS
Sent: 28 July 2018 11:26
To: devel@lists.zephyrproject.org
Subject: [Zephyr-devel] kconfig

Hi,

I am working on a subsystem and I have some problem with Kconfig. I
would like to define a configuration setting: SET_NVS_SECTOR_SIZE and
apply a default equal to the define FLASH_ERASE_BLOCK_SIZE:

config SET_NVS_SECTOR_SIZE
int "sector size used by default NVS backend"
default FLASH_ERASE_BLOCK_SIZE

but this doen't work: cmake complaints that FLASH_ERASE_BLOCK_SIZE is
not defined. However I can use FLASH_ERASE_BLOCK_SIZE in a .c or .h
file, and its value is set correct.

How should I do this in Kconfig ?

Thanks,

Jehudi


laczenJMS
 

Hi Ulf and Carles,

Thanks for the response. It seems that it is not possible to do what I want directly, no problem. I will compare SET_NVS_SECTOR_SIZE with FLASH_ERASE_BLOCK_SIZE in my code to verify that the setup is OK.

Kind regards,

On Mon, Jul 30, 2018, 10:22 Ulf Magnusson <ulfalizer@...> wrote:
Hello,

Looks like this setting comes from DTS. See e.g. the commit message
for commit 9e09e2a ("OpenThread: Change SETTINGS_CONFIG_PAGE_SIZE to
target specific value"), which mentions that it's generated "from
'erase-block-size' found in the dtsi file of devices".

Values from DTS currently can't be used as input to Kconfig, though it
might be nice if they could. There's a related issue:
https://github.com/zephyrproject-rtos/zephyr/issues/7302

Cheers,
Ulf

On Sun, Jul 29, 2018 at 3:47 PM, Cufi, Carles <Carles.Cufi@...> wrote:
> Hi Jehudi,
>
> Kconfig options can only default to values of other Kconfig options, the whole Kconfig system is self-contained and has no access to macros in the code.
> If necessary, you can convert FLASH_ERASE_BLOCK_SIZE to be a Kconfig option perhaps?
>
> Carles
>
>> -----Original Message-----
>> From: devel@... <devel@...> On
>> Behalf Of laczenJMS
>> Sent: 28 July 2018 11:26
>> To: devel@...
>> Subject: [Zephyr-devel] kconfig
>>
>> Hi,
>>
>> I am working on a subsystem and I have some problem with Kconfig. I
>> would like to define a configuration setting: SET_NVS_SECTOR_SIZE and
>> apply a default equal to the define FLASH_ERASE_BLOCK_SIZE:
>>
>> config SET_NVS_SECTOR_SIZE
>>     int "sector size used by default NVS backend"
>>     default FLASH_ERASE_BLOCK_SIZE
>>
>> but this doen't work: cmake complaints that FLASH_ERASE_BLOCK_SIZE is
>> not defined. However I can use FLASH_ERASE_BLOCK_SIZE in a .c or .h
>> file, and its value is set correct.
>>
>> How should I do this in Kconfig ?
>>
>> Thanks,
>>
>> Jehudi
>>
>>
>


Ulf Magnusson <ulfalizer@...>
 

Hello,

Looks like this setting comes from DTS. See e.g. the commit message
for commit 9e09e2a ("OpenThread: Change SETTINGS_CONFIG_PAGE_SIZE to
target specific value"), which mentions that it's generated "from
'erase-block-size' found in the dtsi file of devices".

Values from DTS currently can't be used as input to Kconfig, though it
might be nice if they could. There's a related issue:
https://github.com/zephyrproject-rtos/zephyr/issues/7302

Cheers,
Ulf

On Sun, Jul 29, 2018 at 3:47 PM, Cufi, Carles <Carles.Cufi@nordicsemi.no> wrote:
Hi Jehudi,

Kconfig options can only default to values of other Kconfig options, the whole Kconfig system is self-contained and has no access to macros in the code.
If necessary, you can convert FLASH_ERASE_BLOCK_SIZE to be a Kconfig option perhaps?

Carles

-----Original Message-----
From: devel@lists.zephyrproject.org <devel@lists.zephyrproject.org> On
Behalf Of laczenJMS
Sent: 28 July 2018 11:26
To: devel@lists.zephyrproject.org
Subject: [Zephyr-devel] kconfig

Hi,

I am working on a subsystem and I have some problem with Kconfig. I
would like to define a configuration setting: SET_NVS_SECTOR_SIZE and
apply a default equal to the define FLASH_ERASE_BLOCK_SIZE:

config SET_NVS_SECTOR_SIZE
int "sector size used by default NVS backend"
default FLASH_ERASE_BLOCK_SIZE

but this doen't work: cmake complaints that FLASH_ERASE_BLOCK_SIZE is
not defined. However I can use FLASH_ERASE_BLOCK_SIZE in a .c or .h
file, and its value is set correct.

How should I do this in Kconfig ?

Thanks,

Jehudi


David Leach
 

Note that FLASH_ERASE_BLOCK_SIZE is already used in a similar manner with the OpenThread support. I tied this to:

#define SETTINGS_CONFIG_PAGE_SIZE FLASH_ERASE_BLOCK_SIZE

I did this because previously this PAGE_SIZE setting was hardcoded to a value that was not compatible with the platform I was working with. It seems to me that you can do the same thing by associating the NVS_SECTOR_SIZE to FLASH_ERASE_BLOCK_SIZE in a relevant header to your subsystem instead of trying to do this with Kconfig?

David

-----Original Message-----
From: devel@lists.zephyrproject.org [mailto:devel@lists.zephyrproject.org] On Behalf Of laczenJMS
Sent: Saturday, July 28, 2018 4:26 AM
To: devel@lists.zephyrproject.org
Subject: [Zephyr-devel] kconfig

Hi,

I am working on a subsystem and I have some problem with Kconfig. I would like to define a configuration setting: SET_NVS_SECTOR_SIZE and apply a default equal to the define FLASH_ERASE_BLOCK_SIZE:

config SET_NVS_SECTOR_SIZE
int "sector size used by default NVS backend"
default FLASH_ERASE_BLOCK_SIZE

but this doen't work: cmake complaints that FLASH_ERASE_BLOCK_SIZE is not defined. However I can use FLASH_ERASE_BLOCK_SIZE in a .c or .h file, and its value is set correct.

How should I do this in Kconfig ?

Thanks,

Jehudi