You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "anchao (via GitHub)" <gi...@apache.org> on 2024/07/04 16:23:49 UTC
[PR] arch/sim: add custom data section support [nuttx]
anchao opened a new pull request, #12624:
URL: https://github.com/apache/nuttx/pull/12624
## Summary
arch/sim: add custom data section support
The link script of NuttX Simulator is generated through compilation options. This PR will support configure special data sections in kconfig to meet the support of 3rd party applications.
## Impact
N/A
## Testing
ci-check
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on code in PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#discussion_r1666131398
##########
arch/sim/src/Makefile:
##########
@@ -414,6 +414,9 @@ ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
.kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \
.interp : {*(.interp)}/g' nuttx.ld
endif
+ifneq ($(CONFIG_SIM_CUSTOM_DATA_SECTION),"")
+ $(Q) sed -i '/\.data *:/i $(shell echo $(CONFIG_SIM_CUSTOM_DATA_SECTION))' nuttx.ld
Review Comment:
This config contains double quotes `"`, but the sed /i syntax does not support eliminating them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#issuecomment-2209615282
> @anchao "This PR will support configure special data sections in kconfig to meet the support of 3rd party applications."
>
> Please include a usage example or documentation explaining how 3rd party applications will use it, it could be obvious for you, but maybe not of other developers. :-)
Imagine a 3rd_party library wants to put its "data_img" at nuttx data memory, is it just need to define CONFIG_SIM_CUSTOM_DATA_SECTION as "data_img"?
@xiaoxiang781216 what should be the right place in our Documentation to include it, to avoid another hidden feature?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#discussion_r1666312702
##########
arch/sim/src/Makefile:
##########
@@ -414,6 +414,9 @@ ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
.kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \
.interp : {*(.interp)}/g' nuttx.ld
endif
+ifneq ($(CONFIG_SIM_CUSTOM_DATA_SECTION),"")
+ $(Q) sed -i '/\.data *:/i $(shell echo $(CONFIG_SIM_CUSTOM_DATA_SECTION))' nuttx.ld
Review Comment:
but should we strip quote in Makefile?
##########
arch/sim/src/Makefile:
##########
@@ -414,6 +414,9 @@ ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
.kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \
.interp : {*(.interp)}/g' nuttx.ld
endif
+ifneq ($(CONFIG_SIM_CUSTOM_DATA_SECTION),"")
+ $(Q) sed -i '/\.data *:/i $(shell echo $(CONFIG_SIM_CUSTOM_DATA_SECTION))' nuttx.ld
Review Comment:
but should we strip quote in Makefile in stead shell?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#discussion_r1666312702
##########
arch/sim/src/Makefile:
##########
@@ -414,6 +414,9 @@ ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
.kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \
.interp : {*(.interp)}/g' nuttx.ld
endif
+ifneq ($(CONFIG_SIM_CUSTOM_DATA_SECTION),"")
+ $(Q) sed -i '/\.data *:/i $(shell echo $(CONFIG_SIM_CUSTOM_DATA_SECTION))' nuttx.ld
Review Comment:
but should we strip quote in Makefile instead shell?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #12624:
URL: https://github.com/apache/nuttx/pull/12624
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#issuecomment-2209611497
@anchao "This PR will support configure special data sections in kconfig to meet the support of 3rd party applications."
Please include a usage example or documentation explaining how 3rd party applications will use it, it could be obvious for you, but maybe not of other developers. :-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#issuecomment-2209688351
> Please include a usage example or documentation explaining how 3rd party applications will use it, it could be obvious for you, but maybe not of other developers. :-)
@acassis comment message has been updated
> Imagine a 3rd_party library wants to put its "data_img" at nuttx data memory, is it just need to define CONFIG_SIM_CUSTOM_DATA_SECTION as "data_img"?
@acassis we need to follow the syntax of linker script. In 3rd-party applications, some data will be labeled as section:
```
| a.c:
| struct task_s a __attribute__((section(".data.custom.taska")));
| b.c:
| struct task_s b __attribute__((section(".data.custom.taskb")));
```
Data of the same type struct can be placed in a fixed location to reduce the overhead caused by searching:
```
| .data :
| {
| _custom_data_table_start = .;
| KEEP(*(.data.custom.*))
| _custom_data_table_end = .;
| }
```
Such section declare can be configured via Kconfig in the PR:
```
| CONFIG_SIM_CUSTOM_DATA_SECTION=" .data : { _custom_data_table_start = .; KEEP(*(.data.custom.*)) _custom_data_table_end = .; } "
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#discussion_r1666130820
##########
arch/sim/src/Makefile:
##########
@@ -414,6 +414,9 @@ ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
.kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \
.interp : {*(.interp)}/g' nuttx.ld
endif
+ifneq ($(CONFIG_SIM_CUSTOM_DATA_SECTION),"")
+ $(Q) sed -i '/\.data *:/i $(shell echo $(CONFIG_SIM_CUSTOM_DATA_SECTION))' nuttx.ld
Review Comment:
why not directly use CONFIG_SIM_CUSTOM_DATA_SECTION, but echo it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "anchao (via GitHub)" <gi...@apache.org>.
anchao commented on code in PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#discussion_r1666817252
##########
arch/sim/src/Makefile:
##########
@@ -414,6 +414,9 @@ ifeq ($(CONFIG_MM_KASAN_GLOBAL),y)
.kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \
.interp : {*(.interp)}/g' nuttx.ld
endif
+ifneq ($(CONFIG_SIM_CUSTOM_DATA_SECTION),"")
+ $(Q) sed -i '/\.data *:/i $(shell echo $(CONFIG_SIM_CUSTOM_DATA_SECTION))' nuttx.ld
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] arch/sim: add custom data section support [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #12624:
URL: https://github.com/apache/nuttx/pull/12624#issuecomment-2211032551
Thank you @anchao way better now!
Please to avoid delay this PR, submit another later with this commit log moved to Documentation/
It could help more people instead of been buried in the commit log.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org