csanchezdll commented on code in PR #20367:
URL: https://github.com/apache/nuttx/pull/20367#discussion_r4154462570


##########
boards/arm/common/stm32/src/Make.defs:
##########
@@ -215,6 +215,14 @@ endif
 
 ifeq ($(CONFIG_STM32_ROMFS),y)
   CSRCS += stm32_romfs_initialize.c
+stm32_romfs_initialize.o: ../../../$(patsubst 
"%",%,$(CONFIG_STM32_ROMFS_IMAGEFILE))
+../../../../../apps/examples/elf/main/elf_romfs.img:
+       $(MAKE) -C ../../../../../apps/platform all APPDIR=.. TOPDIR=$(TOPDIR)

Review Comment:
   I agree, I already mentioned above 
(https://github.com/apache/nuttx/pull/20367#issuecomment-5914356263) I did not 
like to add all this rules here.
   
   The problem is, for every other config, libboard can be built on its own, 
but this specific configuration uses a libboard which depends on something 
building in libapps. The goal of my PR is to make libapps build after all the 
system libraries, precisely. So we need libboard built before and after other 
libraries, for different reasons.
   
   This "hack" was the best I could get keeping the change isolated. Other 
possibilities that came to my mind require more in-depth changes (and somewhat 
synchronized PRs in nuttx and apps repos). I am fine to explore. Some ideas / 
options:
   * Change NuttX makefiles so libapps make is invoked twice (before and after 
the other libraries). With clear dependencies, most things will build just once 
and the second invocation will be almost a no-op, except for the little things 
depending on system libraries which will need to be rebuilt. Pros: simple from 
NuttX main repo side. Cons: apps depending on system libraries will need more 
complex makefile rules (but this will remain on the specific app makefile); and 
some extra building time (the second invocation, even if most things are not 
rebuilt, will take some time).
   * Build elf_roms.img early, in libapps. I have not explored inter-library 
dependencies in depth, but if we could move elf_roms.img generation to 
"context" step, then we can build all the system libraries followed by the 
normal libapps. Pros: clean, no extra build time. Cons: might not be possible 
if elf_roms.img requires something which is not ready yet at "context" step; 
requires a PR in apps first.
   * Create an add-hoc target to build elf_roms.img inside apps/examples/elf, 
which will basically include the logic above, but in its apps-side makefile, 
and just invoke make on that target in boards/arm/common/stm32/src/Make.defs. 
Pros: similar to this approach, which I have seen it can be made to work, but 
slightly cleaner. Cons: requires changing apps first, a PR there, then changing 
the PR here; slightly hacky, still.
   
   I can explore, but your (and any other!) opinion on which seems more 
acceptable here will be welcome. I could bring the discussion to the mailing 
list if you think that's better.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to