Assembly file(.S) throw errors with GNU ARM toolchain in Eclipse photon - eclipse

Ported assembly file from ARMCC syntax to GNU syntax. Throwing error while compilation.
Environment: GNU arm toolchain for ARM7 in Eclipse photon.
Requirement: Porting from keil ARMCC to GNU arm toolchain in eclipse.
Compiled and build properly. When I added an assembly file iap_blue.S(attached), facing compilation errors (Pasted below).
//iap_blue.S
.section .text,"x"
.balign 4
.globl blue_execute
blue_execute:
STMFD SP!,{LR} // Save Return Address
ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
ADR LR,blue_exit // Return Address
LDR R2,=0x7FFFFFF1 // IAP Entry (Thumb Mode)
BX R2 // Execute IAP Command
blue_exit:
LDMFD SP!,{LR} // Restore Return Address
BX LR // Return
.end
12:18:38 **** Build of configuration Debug for project LEDblink ****
make all
Building file: ../LPC2468_startup.c
Invoking: GNU ARM Cross C Compiler
arm-none-eabi-gcc -mcpu=arm7tdmi-s -march=armv4t -marm -mthumb-interwork -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -include"E:\EclipseARM\workspace\LEDblink\iap_blue.S" -std=gnu11 -MMD -MP -MF"LPC2468_startup.d" -MT"LPC2468_startup.o" -c -o "LPC2468_startup.o" "../LPC2468_startup.c"
In file included from <command-line>:
E:\EclipseARM\workspace\LEDblink\iap_blue.S:1:13: error: expected identifier or '(' before '.' token
1 | .section .text,"x"
| ^
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:17: error: unknown type name 'ADD'
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^~~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:31: error: stray '#' in program
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:32: error: expected identifier or '(' before numeric constant
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^~~~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:14:17: error: unknown type name 'BX'
14 | BX LR // Return
| ^~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:15:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
15 | .end
| ^
In file included from c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\arm-none-eabi\include\stdint.h:14,
from c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\lib\gcc\arm-none-eabi\9.2.1\include\stdint.h:9,
from ../LPC2468_startup.c:1:
c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\arm-none-eabi\include\sys\_stdint.h:20:9: error: unknown type name '__int8_t'
20 | typedef __int8_t int8_t ;
| ^~~~~~~~
subdir.mk:31: recipe for target 'LPC2468_startup.o' failed
make: *** [LPC2468_startup.o] Error 1

Thank you. Problem is solved.
I will like to elaborate on what was the mistake I was doing and how it is solved. This may be helpful for others.
Mistake 1:
I was using .s instead of .S for assembly file.
Mistake 2:
Included .S file in eclipse compiler include files as part of project settings.
Solution:
Checked C/C++ General --> File types which lists .S as assembly file. I changed .s to .S , mistake 1 is corrected.
Even though I was facing compilation errors which I have posted here.
I was not sure whether there is some eclipse-related issue or issue with my assembly file since I ported it to GNU syntax from ARMCC syntax.
I created my own make file and build the code using a command line, it builds successfully without any error. That means there was some issue with eclipse project configuration.
Then, I realized You don't have include assembly file in compiler settings. If You have already included it in the project. That alone will get the file to be recognized properly and assembled.
This solved the mistake2.
Thank you.

Related

fatal error: json-c/json.h: No such file or directory

I bitbake my foo.bb
I don't know what to do to solve this problem, should I add something in RDEPENDS or DEPENDS?
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 8
| gcc -std=c99 -g -D_XOPEN_SOURCE=600 -lndctl -ljson-c fis.c -o fis
| fis.c:24:10: fatal error: json-c/json.h: No such file or directory
| #include <json-c/json.h>
| ^~~~~~~~~~~~~~~
| compilation terminated.
Add these two lines to your bb file. Try to build foo
DEPENDS = "json-c"
TARGET_LDFLAGS = "-ljson-c"
<json-c/json.h> is provided by the recipe:
poky/meta/recipes-devtools/json-c
In order to make its output available to your recipe at compile time, you should specify it as compile-time dependency using DEPENDS.
foo.bb :
DEPENDS += "json-c"
For more info check here.

I ran into problems with `cmake..`

Because of some requirements, I need to install doxygen on ubuntu 12.04, but I ran into problems with cmake...
The error log as follow:
~/doxygen/build$ cmake ..
-- Found BISON: /usr/bin/bison (found version "2.7")
-- The javacc executable not found, using existing files
-- Configuring done
CMake Error in liblodepng/CMakeLists.txt:
Target "lodepng" requires the language dialect "CXX14" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
CMake Error in libmscgen/CMakeLists.txt:
Target "mscgen" requires the language dialect "CXX14" (with compiler
extensions), but CMake does not know the compile flags to use to enable it.
CMake Error in libversion/CMakeLists.txt:
Target "doxygen_version" requires the language dialect "CXX14" (with
compiler extensions), but CMake does not know the compile flags to use to
enable it.
.
.
.
.
.
.
-- Generating done
-- Build files have been written to: /home/nfore/doxygen/build
#albert The problem has been resolved by update GCC into gcc-6 g++-6.
But I ran into new problems as follow:
clang version is Ubuntu clang version 3.4-1ubuntu3~precise2 (tags/RELEASE_34/final) (based on LLVM 3.4)
~/build$ cmake ..
~/build$ make
Building CXX object src/CMakeFiles/doxymain.dir/context.cpp.o
In file included from /home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/context.h:20:0,
from /home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/context.cpp:19:
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:238:20: error: enclosing class of constexpr non-static member function ‘bool TemplateVariant::isValid() const’ is not a literal type
constexpr bool isValid() const { return m_variant.valid(); }
^~~~~~~
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:92:7: note: ‘TemplateVariant’ is not literal because:
class TemplateVariant
^~~~~~~~~~~~~~~
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:92:7: note: ‘TemplateVariant’ has a non-trivial destructor
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:240:20: error: enclosing class of constexpr non-static member function ‘bool TemplateVariant::isBool() const’ is not a literal type
constexpr bool isBool() const { return m_variant.is<bool>(); }
.
.
.
/home/nfore/windows-kenny/doxygen/doxygen-1.9.2/src/template.h:311:27: error: enclosing class of constexpr non-static member function ‘const char* TemplateVariant::typeAsString() const’ is not a literal type
constexpr const char *typeAsString() const
^~~~~~~~~~~~
make[2]: *** [src/CMakeFiles/doxymain.dir/context.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/doxymain.dir/all] Error 2
make: *** [all] Error 2

Adding new dts to Raspberry Yocto project

I have an experimental hardware connected to Raspberry's GPIO lines, and related dts file has been created. In Raspbian, the kernel module and dtbo (overlay) works well i.e. the hardware can be controlled.
Now I have tried to port this to Yocto 2.7.1 using Jumpnowtek's meta-rpi layer [x]. The kernel module porting was otherwise successful (at least, I did not get any complains during compilation), but I haven't been able to add the dts file to system such, that it would be automatically compiled to dtbo and added to /boot/overlays -directory.
[x] https://jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html
I have created a linux-raspberrypi_4.19.bbappend recipe as follows:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://newlayer.dts"
RPI_KERNEL_DEVICETREE_OVERLAYS_append = " overlays/newlayer.dtbo "
do_compile_prepend() {
sed -i '/dtbo-$(CONFIG_ARCH_BCM2835) += \\/a newlayer.dtbo \\' ${S}/arch/${ARCH}/boot/dts/overlays/Makefile
cp ${WORKDIR}/newlayer.dts ${S}/arch/${ARCH}/boot/dts/overlays/
}
When I execute the "bitbake console-image", I get following error:
| make[3]: *** No rule to make target 'arch/arm/boot/dts/overlays/newlayer.dtbo'. Stop.
| make[2]: *** [arch/arm/Makefile:345: overlays/newlayer.dtbo] Error 2
| make[1]: *** [Makefile:146: sub-make] Error 2
| make: *** [Makefile:24: __sub-make] Error 2
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
If I don't add the "RPI_KERNEL_DEVICETREE_OVERLAYS_append" line, I don't get any error message, but the dts file won't be compiled either. It seems, that contents of the mentioned variable control, which dts files will be compiled.
Any help is welcome.

Error in ./configure step in installation of libpqxx

this is a bit of a long shot but:
I'm following this guide: https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
But when running ./configure I get the following error:
(previous checking lines omitted for brevity)
checking for main in -lpq... yes
checking for PQexec in -lpq... yes
checking for correct C++ linkage of basic libpq functions...
sed: character class syntax is [[:space:]], not [:space:]
configure: error:
Linking a call to libpq failed in C++, even though it succeeded in C. If your
C and C++ compilers are very different beasts, this may mean that we do not have
the right options for linking with it after all.
Read the config.log file for more detailed information. Look for the last error
message, which may be several pages up from the end of the file.
And the configure.log file looks like this:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpqxx configure 4.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
(some lines omitted)
configure:3039: g++ -V >&5
g++: error: unrecognized command line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:3050: $? = 1
configure:3039: g++ -qversion >&5
g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
g++: fatal error: no input files
compilation terminated.
(some lines omitted)
configure:7629: gcc -E conftest.c
conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
(some lines omitted)
configure:8319: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5
cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
(some lines omitted)
configure:16424: g++ -o conftest -g -O2 -L/usr/lib/x86_64-linux-gnu conftest.cpp >&5
/tmp/ccfFBf4K.o: In function `main':
/home/peter/libpqxx-4.0/conftest.cpp:44: undefined reference to `PQexec'
collect2: error: ld returned 1 exit status
(some liens omitted)
I don't believe I have any packages missing. I have the newest version of g++, psql and libpqxx installed.
I have updated and upgraded all packages on my system.
I have crawled the web for solutions to this error, but I have no clue what is wrong.
Do you have an idea where I can go from here?
There hasn't been a tarball release of libpqxx at the old spot in a long time, so the tutorial you used with its wget command to download the tarball is very outdated.
The issue you encountered looks related to this issue and appears to have been fixed in this commit:
commit 85e9336740475be25ed19924cca0961f7d844c4b
Author: Jeroen Vermeulen <jtvjtv#gmail.com>
Date: Thu Jun 1 11:39:08 2017 +0700
Fix #13: not linking to libpq.
This was that annoying interaction between autoconf, m4, GNU sed syntax,
and the shell which broke the "remove redundant -lpq options" code in
the configure script.
Solution: forget about GNU sed's "[[:space:]]" syntax, and just look for
a literal space. There aren't going to be any tabs, newlines,
non-breaking spaces, etc. there in even a moderately sane world.

How to enable dbus-X11 in the yocto

I'm using poky and meta-openembedded(git://git.openembedded.org/meta-openembedded(branch: master)) in yocto
I want to build metacity and cyrus-sasl(2.1.26) for my SDK platform
I run the following command
I add BBCLASSEXTEND += " nativesdk" to metacity's bb
and run bitbake nativesdk-metacity
but I will get error message
ERROR: Nothing RPROVIDES 'nativesdk-dbus-x11' (but virtual:nativesdk:poky/meta/rec on or otherwise requires it)
ERROR: Nothing RPROVIDES 'nativesdk-dbus-x11' (but virtual:nativesdk:poky/meta/recipes-core/dbus/dbus-glib_0.110.bb RDEPENDS on or otherwise requires it) ERROR: Required build target 'nativesdk-metacity' has no buildable providers. Missing or unbuildable dependency chain was: ['nativesdk-metacity', 'nativesdk-libcanberra', 'nativesdk-pulseaudio', 'nativesdk-gconf', 'nativesdk-dbus-glib', 'nativesdk-dbus-x11']
ERROR: Nothing PROVIDES 'dbus-x11'. Close matches:
dbus RPROVIDES dbus-x11
I cannot find dbus-x11's bb in my all meta
and I cannot see dbus-x11 then run bitbake -s
How can I enable dbus-x11 ??
and...
I also add BBCLASSEXTEND += " nativesdk" to cyrus-sasl_2.1.26.bb
and bitbake nativesdk-cyrus-sasl
get error message
| x86_64-pokysdk-linux-gcc --sysroot=/poky/build-fw/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-cyrus-sasl/2.1.26-r0/recipe-sysroot -O2 -pipe -Wl,-O1 -o saslauthd mechanisms.o auth_dce.o auth_getpwent.o auth_krb5.o auth_krb4.o auth_pam.o auth_rimap.o auth_httpform.o auth_shadow.o auth_sia.o auth_sasldb.o lak.o auth_ldap.o cache.o cfile.o krbtf.o utils.o ipc_unix.o ipc_doors.o saslauthd-main.o md5.o -lresolv
| auth_getpwent.o: In function `auth_getpwent':
| auth_getpwent.c:(.text+0x42): undefined reference to `crypt'
| auth_shadow.o: In function `auth_shadow':
| auth_shadow.c:(.text+0x109): undefined reference to `crypt'
| collect2: error: ld returned 1 exit status
| Makefile:456: recipe for target 'saslauthd' failed
How can I add -lcrypt to cyrus-sasl_2.1.26.bb bb??
thanks a lot
John