I have made a package in package folder of openwrt
Also added Config.in file to select the option from menuconfig
I am successfully getting the option value in Makefile
But when I am trying to get the data in my C code as a macro but, I am Unable to get the value in the code
Below I have mentioned that which file contains what data
Config.in
config PWM_ENABLE
bool "PWM enable"
help
This makes PWM enable
default n
endmenu
outer Makefile
ifeq ($(CONFIG_PWM_ENABLE),y)
PMW_ENABLE_VAL := 1
$(info PWM val is $(PMW_ENABLE_VAL))
export PMW_ENABLE_VAL
endif
We have requirement to enable configuration like CONFIG_PWM_ENABLE which we want to utilize into our application code.
We have tried to include configuration into config.in and also checked into MAKE File of application package code which is working fine but we are not able to utilize same CONFIG_PWM_ENABLE into our application c code.
Can anyone has used like this into any of OPENWRT based application which will be helpful for us to move further?
Can anyone help here like how to use CONFIG_XXXX into application c code because we have tried multiple ways to use into application c code but didn't get any success yet?
We have already configured into config.in file like below
config PWM_ENABLE
bool "PWM enable"
help
This makes PWM enable
default n
endmenu
And we are targeting to use CONFIG_PWM_ENABLE into application c code but somehow it is not accessible to application c code.
So, Let me know if anyone has created and used CONFIG Macro like we want to use so that it will be helpful for us to move further for application development perspective
If I'm not mistaken (and understand you correctly) there is no full direct access to kernel config parameters at package configuration stage (make menuconfig).
But there exist some partial preset from generic + each target (e.g. generic).
And these presets are visible as CONFIG_KERLNEL_XXX instead of CONFIG_XXX. Kernel config parameters which are set form the same make menuconfig may be visible too.
Actually our requirement is to use CONFIG_XXXX Macro into application c code instead of any kernel driver.
So, We want to enable MACRO using make menuconfig into openWRT build which should be accessible into Application C Code which is enabled and cross compiled into OpenWRT Build.
Hope now you are clear like what i want to do. Still feel free to ask anything if you have any questions for the same.
So you means CONFIG_XXX as parameter of your package only. Not kernel?
In this case there exist good example - package/utils/busybox package which may be highly customizable. Or package/libs/wolfssl
Use of macro in the code
---> RECEIVED_VAL(AES_VAL)
When the above macros is called then the MACRO value is read and we can receive it as string and we can use it in the C file as mention below printf("AES VALUS Is : %s\n", RECEIVED_VAL(AES_VAL));
Above is the solution of of getting macro from config.in file