You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Roberto Bucher <ro...@supsi.ch> on 2023/01/05 07:30:43 UTC
Problem with exported lib
Hi
I have a new configuration for an Olimex-ESP32-PoE board. I can compile
and build the nuttx flash without problems.
I did a
make export
and putted the generated nuttx-export folder into another project
(pysimCoder). The Makefile of the project, which correctly works with my
STM32 boards, fails the compilation of the image for esp32 with this
strange message:
....
xtensa-esp32-elf-ld -nostdlib --gc-sections --cref
-Map=/home/bucher/sviluppo/NUTTX/nuttx/nuttx.map -L
/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/libs
--entry=__start -T
/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/esp32_rom.ld
-T
/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld
-T
/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/legacy_sections.ld
\
-o ../test \
nuttx_main.o test.o nuttx_main-builtintab.o
/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/lib/libpyblk.a --start-group
-lsched -ldrivers -lboards -lc -lmm -larch -lxx -lapps -lnet -lfs
-lbinfmt -lwireless -lboard -lboard
/home/bucher/sviluppo/GITHUB/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/11.2.0/libgcc.a
--end-group
*xtensa-esp32-elf-ld:/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld:32:
ignoring invalid character `#' in expression**
**xtensa-esp32-elf-ld:/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld:32:
syntax error**
**make: *** [Makefile:133: ../test] Error 1**
*....
The line 32 of the script "flat_memory.ld" contains simply the line
#include <nuttx/config.h>
Hints are welcomed!
Thanks in advance
Roberto
Re: Problem with exported lib
Posted by Gustavo Henrique Nihei <gh...@gmail.com>.
Hi Roberto,
The "export" command packs header and object files generated during build,
allowing the user to import them into custom applications and out-of-tree
boards.
Linker scripts and compiler/linker flags should not be exported because
those, in general, are both board and application-specific.
So when creating a custom out-of-tree application the user should maintain
a custom linker script which better suits the application requirements.
In your case, you may either improve the build system from your external
project to perform the preprocessing of the linker script files the same
way the build system from upstream NuttX does, or you may simply modify
your copies of the linker scripts and remove the preprocess directives
(e.g. #include and #ifdef's) so that preprocessing is no longer necessary.
Best regards,
Gustavo.
On Mon, Jan 9, 2023 at 4:57 AM Roberto Bucher <ro...@supsi.ch>
wrote:
> Thanks Gustavo
>
> sorry for late replay..
>
> Why are not all these flags and the correct ld.tmp files exported when
> we generate the nuttx-export file?
>
> It will be corrected in the future or do we modify our files that
> automatically generate nuttx binaries to this?
>
> Thanks again
>
> Roberto
>
>
> On 1/5/23 14:52, Gustavo Henrique Nihei wrote:
> > Hi Roberto,
> >
> > Since https://github.com/apache/nuttx/pull/7208 the NuttX build system
> > preprocesses every linker script file of a given configuration.
> > We've recently updated the makefiles and linker scripts of every
> supported
> > chip from the ESP32 family to benefit from this.
> > So you may need to update your out-of-tree build system to also
> preprocess
> > each linker script file (e.g. using "-E" argument from GCC) and pass the
> > output files to xtensa-esp32-elf-ld.
> > Notice that you'll need to provide all the include paths to GCC so that
> it
> > is able to find the headers required at the processing phase.
> >
> > As a reference, if you build "esp32-devkitc:nsh" with "make V=1", you'll
> > notice that for each ".ld" file the build system will generate a new one
> > suffixed with ".ld.tmp", which are the ones to be passed to the Linker:
> >
> >
> > *CPP:
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld->
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld.tmp
> >
> > xtensa-esp32-elf-gcc -E -P -x c -isystem
> > /home/nihei/Projects/NuttX/nuttx/include -D__NuttX__ -DNDEBUG
> -D__KERNEL__
> > -I /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
> > /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
> > /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
> > /home/nihei/Projects/NuttX/nuttx/sched
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld
> > -o
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld.tmp*
> >
> >
> > *CPP:
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld->
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld.tmpxtensa-esp32-elf-gcc
> > -E -P -x c -isystem /home/nihei/Projects/NuttX/nuttx/include -D__NuttX__
> > -DNDEBUG -D__KERNEL__ -I
> > /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
> > /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
> > /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
> > /home/nihei/Projects/NuttX/nuttx/sched
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld
> > -o
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld.tmp*
> >
> >
> > *CPP:
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld->
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld.tmp
> >
> > xtensa-esp32-elf-gcc -E -P -x c -isystem
> > /home/nihei/Projects/NuttX/nuttx/include -D__NuttX__ -DNDEBUG
> -D__KERNEL__
> > -I /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
> > /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
> > /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
> > /home/nihei/Projects/NuttX/nuttx/sched
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld
> > -o
> >
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld.tmp*
> >
> > Best regards,
> > Gustavo.
> >
> > On Thu, Jan 5, 2023 at 4:31 AM Roberto Bucher <ro...@supsi.ch>
> > wrote:
> >
> >> Hi
> >>
> >> I have a new configuration for an Olimex-ESP32-PoE board. I can compile
> >> and build the nuttx flash without problems.
> >>
> >> I did a
> >>
> >> make export
> >>
> >> and putted the generated nuttx-export folder into another project
> >> (pysimCoder). The Makefile of the project, which correctly works with my
> >> STM32 boards, fails the compilation of the image for esp32 with this
> >> strange message:
> >>
> >> ....
> >> xtensa-esp32-elf-ld -nostdlib --gc-sections --cref
> >> -Map=/home/bucher/sviluppo/NUTTX/nuttx/nuttx.map -L
> >> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/libs
> >> --entry=__start -T
> >>
> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/esp32_rom.ld
> >>
> >> -T
> >>
> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld
> >>
> >> -T
> >>
> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/legacy_sections.ld
> >>
> >> \
> >> -o ../test \
> >> nuttx_main.o test.o nuttx_main-builtintab.o
> >> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/lib/libpyblk.a --start-group
> >> -lsched -ldrivers -lboards -lc -lmm -larch -lxx -lapps -lnet -lfs
> >> -lbinfmt -lwireless -lboard -lboard
> >>
> /home/bucher/sviluppo/GITHUB/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/11.2.0/libgcc.a
> >>
> >> --end-group
> >>
> *xtensa-esp32-elf-ld:/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld:32:
> >>
> >> ignoring invalid character `#' in expression**
> >>
> **xtensa-esp32-elf-ld:/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld:32:
> >>
> >> syntax error**
> >> **make: *** [Makefile:133: ../test] Error 1**
> >> *....
> >>
> >> The line 32 of the script "flat_memory.ld" contains simply the line
> >>
> >> #include <nuttx/config.h>
> >>
> >> Hints are welcomed!
> >>
> >> Thanks in advance
> >>
> >> Roberto
> >
> >
>
>
--
Gustavo Henrique Nihei
Re: Problem with exported lib
Posted by Roberto Bucher <ro...@supsi.ch>.
Thanks Gustavo
sorry for late replay..
Why are not all these flags and the correct ld.tmp files exported when
we generate the nuttx-export file?
It will be corrected in the future or do we modify our files that
automatically generate nuttx binaries to this?
Thanks again
Roberto
On 1/5/23 14:52, Gustavo Henrique Nihei wrote:
> Hi Roberto,
>
> Since https://github.com/apache/nuttx/pull/7208 the NuttX build system
> preprocesses every linker script file of a given configuration.
> We've recently updated the makefiles and linker scripts of every supported
> chip from the ESP32 family to benefit from this.
> So you may need to update your out-of-tree build system to also preprocess
> each linker script file (e.g. using "-E" argument from GCC) and pass the
> output files to xtensa-esp32-elf-ld.
> Notice that you'll need to provide all the include paths to GCC so that it
> is able to find the headers required at the processing phase.
>
> As a reference, if you build "esp32-devkitc:nsh" with "make V=1", you'll
> notice that for each ".ld" file the build system will generate a new one
> suffixed with ".ld.tmp", which are the ones to be passed to the Linker:
>
>
> *CPP:
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld->
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld.tmp
>
> xtensa-esp32-elf-gcc -E -P -x c -isystem
> /home/nihei/Projects/NuttX/nuttx/include -D__NuttX__ -DNDEBUG -D__KERNEL__
> -I /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
> /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
> /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
> /home/nihei/Projects/NuttX/nuttx/sched
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld
> -o
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld.tmp*
>
>
> *CPP:
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld->
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld.tmpxtensa-esp32-elf-gcc
> -E -P -x c -isystem /home/nihei/Projects/NuttX/nuttx/include -D__NuttX__
> -DNDEBUG -D__KERNEL__ -I
> /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
> /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
> /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
> /home/nihei/Projects/NuttX/nuttx/sched
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld
> -o
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld.tmp*
>
>
> *CPP:
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld->
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld.tmp
>
> xtensa-esp32-elf-gcc -E -P -x c -isystem
> /home/nihei/Projects/NuttX/nuttx/include -D__NuttX__ -DNDEBUG -D__KERNEL__
> -I /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
> /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
> /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
> /home/nihei/Projects/NuttX/nuttx/sched
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld
> -o
> /home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld.tmp*
>
> Best regards,
> Gustavo.
>
> On Thu, Jan 5, 2023 at 4:31 AM Roberto Bucher <ro...@supsi.ch>
> wrote:
>
>> Hi
>>
>> I have a new configuration for an Olimex-ESP32-PoE board. I can compile
>> and build the nuttx flash without problems.
>>
>> I did a
>>
>> make export
>>
>> and putted the generated nuttx-export folder into another project
>> (pysimCoder). The Makefile of the project, which correctly works with my
>> STM32 boards, fails the compilation of the image for esp32 with this
>> strange message:
>>
>> ....
>> xtensa-esp32-elf-ld -nostdlib --gc-sections --cref
>> -Map=/home/bucher/sviluppo/NUTTX/nuttx/nuttx.map -L
>> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/libs
>> --entry=__start -T
>> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/esp32_rom.ld
>>
>> -T
>> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld
>>
>> -T
>> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/legacy_sections.ld
>>
>> \
>> -o ../test \
>> nuttx_main.o test.o nuttx_main-builtintab.o
>> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/lib/libpyblk.a --start-group
>> -lsched -ldrivers -lboards -lc -lmm -larch -lxx -lapps -lnet -lfs
>> -lbinfmt -lwireless -lboard -lboard
>> /home/bucher/sviluppo/GITHUB/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/11.2.0/libgcc.a
>>
>> --end-group
>> *xtensa-esp32-elf-ld:/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld:32:
>>
>> ignoring invalid character `#' in expression**
>> **xtensa-esp32-elf-ld:/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld:32:
>>
>> syntax error**
>> **make: *** [Makefile:133: ../test] Error 1**
>> *....
>>
>> The line 32 of the script "flat_memory.ld" contains simply the line
>>
>> #include <nuttx/config.h>
>>
>> Hints are welcomed!
>>
>> Thanks in advance
>>
>> Roberto
>
>
Re: Problem with exported lib
Posted by Gustavo Henrique Nihei <gh...@gmail.com>.
Hi Roberto,
Since https://github.com/apache/nuttx/pull/7208 the NuttX build system
preprocesses every linker script file of a given configuration.
We've recently updated the makefiles and linker scripts of every supported
chip from the ESP32 family to benefit from this.
So you may need to update your out-of-tree build system to also preprocess
each linker script file (e.g. using "-E" argument from GCC) and pass the
output files to xtensa-esp32-elf-ld.
Notice that you'll need to provide all the include paths to GCC so that it
is able to find the headers required at the processing phase.
As a reference, if you build "esp32-devkitc:nsh" with "make V=1", you'll
notice that for each ".ld" file the build system will generate a new one
suffixed with ".ld.tmp", which are the ones to be passed to the Linker:
*CPP:
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld->
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld.tmp
xtensa-esp32-elf-gcc -E -P -x c -isystem
/home/nihei/Projects/NuttX/nuttx/include -D__NuttX__ -DNDEBUG -D__KERNEL__
-I /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
/home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
/home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
/home/nihei/Projects/NuttX/nuttx/sched
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld
-o
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/esp32_rom.ld.tmp*
*CPP:
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld->
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld.tmpxtensa-esp32-elf-gcc
-E -P -x c -isystem /home/nihei/Projects/NuttX/nuttx/include -D__NuttX__
-DNDEBUG -D__KERNEL__ -I
/home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
/home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
/home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
/home/nihei/Projects/NuttX/nuttx/sched
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld
-o
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/flat_memory.ld.tmp*
*CPP:
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld->
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld.tmp
xtensa-esp32-elf-gcc -E -P -x c -isystem
/home/nihei/Projects/NuttX/nuttx/include -D__NuttX__ -DNDEBUG -D__KERNEL__
-I /home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/chip -I
/home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/common -I
/home/nihei/Projects/NuttX/nuttx/arch/xtensa/src/lx6 -I
/home/nihei/Projects/NuttX/nuttx/sched
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld
-o
/home/nihei/Projects/NuttX/nuttx/boards/xtensa/esp32/esp32-devkitc/../common/scripts/legacy_sections.ld.tmp*
Best regards,
Gustavo.
On Thu, Jan 5, 2023 at 4:31 AM Roberto Bucher <ro...@supsi.ch>
wrote:
> Hi
>
> I have a new configuration for an Olimex-ESP32-PoE board. I can compile
> and build the nuttx flash without problems.
>
> I did a
>
> make export
>
> and putted the generated nuttx-export folder into another project
> (pysimCoder). The Makefile of the project, which correctly works with my
> STM32 boards, fails the compilation of the image for esp32 with this
> strange message:
>
> ....
> xtensa-esp32-elf-ld -nostdlib --gc-sections --cref
> -Map=/home/bucher/sviluppo/NUTTX/nuttx/nuttx.map -L
> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/libs
> --entry=__start -T
> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/esp32_rom.ld
>
> -T
> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld
>
> -T
> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/legacy_sections.ld
>
> \
> -o ../test \
> nuttx_main.o test.o nuttx_main-builtintab.o
> /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/lib/libpyblk.a --start-group
> -lsched -ldrivers -lboards -lc -lmm -larch -lxx -lapps -lnet -lfs
> -lbinfmt -lwireless -lboard -lboard
> /home/bucher/sviluppo/GITHUB/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/11.2.0/libgcc.a
>
> --end-group
> *xtensa-esp32-elf-ld:/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld:32:
>
> ignoring invalid character `#' in expression**
> **xtensa-esp32-elf-ld:/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export/scripts/flat_memory.ld:32:
>
> syntax error**
> **make: *** [Makefile:133: ../test] Error 1**
> *....
>
> The line 32 of the script "flat_memory.ld" contains simply the line
>
> #include <nuttx/config.h>
>
> Hints are welcomed!
>
> Thanks in advance
>
> Roberto
--
Gustavo Henrique Nihei