You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Pavel Pisa <pp...@pikron.com> on 2021/07/19 16:51:12 UTC

Re: NuttX export cannot set some variables (i.e. LDSTARTGROUP LDENDGROUP) Was: NuttX ELF loadable applications and modules build broken

Hello Xiang Xiao,

On Monday 19 of July 2021 16:59:01 Xiang Xiao wrote:
> > From: Pavel Pisa <pp...@pikron.com>
> > Sent: Monday, July 19, 2021 10:46 PM
...
> > # NuttX modules are ELF binaries.
> > # Non-ELF platforms like macOS need to use a separate ELF toolchain.
> > ifeq ($(CONFIG_HOST_MACOS),y)
> >   # eg. brew install x86_64-elf-gcc
> >   MODULECC = x86_64-elf-gcc
> >   MODULELD = x86_64-elf-ld
>
> How about we change to x86_64-elf-gcc too?

It would lead to unification which I like.

It would be great is somebody working on MAC OS
can try such change and do real tests.

I have found cause for broken/empty
LDENDGROUP and LDSTARTGROUP in exported Make.defs

  nuttx-export-10.1.0-RC1/scripts/Make.defs

as

  LDENDGROUP       =
  LDFLAGS          = -nostartfiles -nodefaultlibs
  LDSTARTGROUP     =

The reason is that

  tools/mkexport.sh

invokes

  ${MAKE} -C "${TOPDIR}/tools" -f Makefile.export TOPDIR="${TOPDIR}"

tools/Makefile.export includes

  include $(TOPDIR)/.config
  include $(EXPORTDIR)/Make.defs

and generates temporary ${EXPORTDIR}/makeinfo.sh"

But LDENDGROUP and LDSTARTGROUP are defined in

  arch/{avr,hc,mips,misoc,or1k,renesas,risc-v,sim,x86,x86_64,xtensa}/src/Makefile

which are not sourced by tools/Makefile.export.

Only exception is arch/arm/src/rtl8720c/Toolchain.defs which could
probably work.

The question is if to try to source complete Makefile by export
(probably would lead to other problems) or to change how architectures
defines these options for toolchain.

It can take more time to solve this problem  clean way.
May it be it solves if build system is switched.
I would prefer meson + ninja above cmake or stay with
GNU make, but cmake support is one of the most robust
options today.

As for temporal workaround I suggest to define some flag
in each Make.defs setting LD=*-gcc to indicate that

  LINK_IS_DONE_BY_CC=y

Or may it be set it in arch Kconfig then it can be used
even during configuration or can be configurable,
which would do probably more harm than proffit.

Actual state is that LDENDGROUP and LDSTARTGROUP
mustnot be used in builds using exported Make.defs
directly. Use requires check that they are empty
and workaround as has been hacked into pysimCoder.

Best wishes,

Pavel



Re: NuttX export cannot set some variables (i.e. LDSTARTGROUP LDENDGROUP HEAD_OBJ)

Posted by Pavel Pisa <pp...@pikron.com>.
Hello Alan,

On Sunday 17 of April 2022 14:22:21 Alan Carvalho de Assis wrote:
> Did you have some idea about last time that "make export" was working?
>
> This feature is used by PX4 project too. I think it needs to be fixed
> before current release. I'm on vacation without a laptop to test it.

I think that some toolchain options did never propagate to

  nuttx-export/scripts/Make.defs

but that was not a problem till the linking started to alter between
GCC and GNU LD which started to need LDSTARTGROUP and LDENDGROUP
to adjust these once to use and once not -Wl,

I have somehow adapted for this missing information in my code

ifneq ($(filter -Wl%, $(NXFLATLDFLAGS1)$(NXFLATLDFLAGS2)),)
GCC_LD_OPTION = -Wl,
endif

But with extension of support of the pysimCoder, Matlab Simulink NuttX target
and our OMK based motion, CAN and RS-485 communication project to RISC-V based 
ESP32C3 the missing/empty HEAD_OBJ information is already hard to resolve
automatically problem. So I rise priority of the problem reported on July 2021
on mailinglist only because if not solved we need to do manual adjustment each 
time when export is copied into our projects.

My finding and thoughts are summarized at

  https://github.com/apache/incubator-nuttx/issues/6082

Best wishes,

Pavel 

Re: NuttX export cannot set some variables (i.e. LDSTARTGROUP LDENDGROUP HEAD_OBJ)

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Pavel,

Did you have some idea about last time that "make export" was working?

This feature is used by PX4 project too. I think it needs to be fixed
before current release. I'm on vacation without a laptop to test it.

About CMake support is was done by Matias some years ago, but it suffered
resistance to enter because NuttX current building system is working fine
for many years. So discussing about transition and how to get both working
without duplicating users work is a question to answer.

BR,

Alan

On Saturday, April 16, 2022, Pavel Pisa <pp...@pikron.com> wrote:

> Hello everybody,
>
> as it seems that new release is near to be published
> I would like to remind that here is significant
> issue which complicates use of NuttX export to base more
> applications on it, i.e. pysimCoder https://github.com/
> robertobucher/pysimCoder
> our OMK build which allows to build complete CAN/CANopen
> OrtCAN infrastructure http://ortcan.sourceforge.net/
> and uLAN RS-485 communication http://ulan.sourceforge.net/,
> motion control PXMC http://pxmc.org/ etc.
>
> The code has been successfully tested with NuttX in the past
> and we want to test our CAN/CANopen framework with actual
> NuttX even on ESP32C3 now when Jan Charvat's CAN (TWAI)
> driver has been included.
>
> I can help to solve the problem but some feedback is necessary.
> It seems that actual release will be based on GNU make system.
> Is that right? What are plans with cmake?
> If it worth to dive into actual stuff.
>
> Are there some suggestions and expectations what would
> broke if right arch Makefile with low level defines
> is included into tools/Makefile.export
>
>   arch/{avr,hc,mips,misoc,or1k,renesas,risc-v,sim,x86,x86_64,
> xtensa}/src/Makefile
>
> How should it be included to work for all architectures?
>
> The issue is open not keep remembering this significant
> issue with use of NuttX as base for more complex projects
> which cannot be directly hacked into NuttX apps repo
>
>   https://github.com/apache/incubator-nuttx/issues/6082
>
> Best wishes,
>
>                 Pavel
>
> --
>                 Pavel Pisa
>     phone:      +420 603531357
>     e-mail:     pisa@cmp.felk.cvut.cz
>     Department of Control Engineering FEE CVUT
>     Karlovo namesti 13, 121 35, Prague 2
>     university: http://control.fel.cvut.cz/
>     company:    https://www.pikron.com/
>     personal:   http://cmp.felk.cvut.cz/~pisa
>     projects:   https://www.openhub.net/accounts/ppisa
>     CAN related:http://canbus.pages.fel.cvut.cz/
>     Open Technologies Research Education and Exchange Services
>     https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home
>
>

Re: NuttX export cannot set some variables (i.e. LDSTARTGROUP LDENDGROUP HEAD_OBJ)

Posted by Pavel Pisa <pp...@pikron.com>.
Hello everybody,

as it seems that new release is near to be published
I would like to remind that here is significant
issue which complicates use of NuttX export to base more
applications on it, i.e. pysimCoder https://github.com/robertobucher/pysimCoder
our OMK build which allows to build complete CAN/CANopen
OrtCAN infrastructure http://ortcan.sourceforge.net/
and uLAN RS-485 communication http://ulan.sourceforge.net/,
motion control PXMC http://pxmc.org/ etc.

The code has been successfully tested with NuttX in the past
and we want to test our CAN/CANopen framework with actual
NuttX even on ESP32C3 now when Jan Charvat's CAN (TWAI)
driver has been included.

I can help to solve the problem but some feedback is necessary.
It seems that actual release will be based on GNU make system.
Is that right? What are plans with cmake?
If it worth to dive into actual stuff.

Are there some suggestions and expectations what would
broke if right arch Makefile with low level defines
is included into tools/Makefile.export

  arch/{avr,hc,mips,misoc,or1k,renesas,risc-v,sim,x86,x86_64,xtensa}/src/Makefile

How should it be included to work for all architectures?

The issue is open not keep remembering this significant
issue with use of NuttX as base for more complex projects
which cannot be directly hacked into NuttX apps repo 

  https://github.com/apache/incubator-nuttx/issues/6082

Best wishes,

                Pavel

--
                Pavel Pisa
    phone:      +420 603531357
    e-mail:     pisa@cmp.felk.cvut.cz
    Department of Control Engineering FEE CVUT
    Karlovo namesti 13, 121 35, Prague 2
    university: http://control.fel.cvut.cz/
    company:    https://www.pikron.com/
    personal:   http://cmp.felk.cvut.cz/~pisa
    projects:   https://www.openhub.net/accounts/ppisa
    CAN related:http://canbus.pages.fel.cvut.cz/
    Open Technologies Research Education and Exchange Services
    https://gitlab.fel.cvut.cz/otrees/org/-/wikis/home