error flag preserving saltform of this instruction not available是什么错误

This site required JavaScript
to be enabled. Below is a
static menu.
How FreeRTOS Works
FreeRTOS Interactive!
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts.
link to reply to a post, or .
[]&&[]&&[]&&[]&&[]
Port from CM3 to CM0 ProblemsPosted by
on May 23, 2013Developing under Keil.
Have been developing and executing for CM3 based NXP processor for several months.
Trying to port same code to CM0 based processor but get several compiler errors from port.c and assemble errors from my startup file.
I assume I should be using a different port.c but am unclear which one to choose from or whether there is one delivered with the standard FreeRTOS download.
I am using the port.c in the RVDS\ARM_CM3 directory and the FreeRTOS version is 7.3.0.
Below are the errors I am getting...\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(197): error: A1874E: Specified register list cannot be loaded or stored in target instruction set..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(199): error: A1859E: Flag preserving form of this instruction not available..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(200): error: A1477E: This register combination results in UNPREDICTABLE behaviour..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(201): error: A1618E: Specified instruction is not supported by the current instruction set..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(292): error: A1874E: Specified register list cannot be loaded or stored in target instruction set..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(296): error: A1859E: Flag preserving form of this instruction not available..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(297): error: A1477E: This register combination results in UNPREDICTABLE behaviour..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(299): error: A1859E: Flag preserving form of this instruction not available..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(300): error: A1477E: This register combination results in UNPREDICTABLE behaviour..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(301): error: A1874E: Specified register list cannot be loaded or stored in target instruction set..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(305): error: A1874E: Specified register list cannot be loaded or stored in target instruction set..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(474): error: A1477E: This register combination results in UNPREDICTABLE behaviour..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(475): error: A1859E: Flag preserving form of this instruction not available..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(476): error: A1477E: This register combination results in UNPREDICTABLE behaviour..\..\..\..\validation_framework\FreeRTOSV7.3.0\FreeRTOSV7.3.0\FreeRTOS\Source\portable\RVDS\ARM_CM3\port.c(485): error: A1477E: This register combination results in UNPREDICTABLE behaviourRE: Port from CM3 to CM0 ProblemsPosted by
on May 23, 2013You won't be able to use the CM3 port on a CM0.
There are official FreeRTOS CM0 ports for IAR and GCC, but unfortunately not Keil.
You may find an NXP Keil port on
if you are lucky, but the NXP port is slightly different to the FreeRTOS distributed code.You could probably create a port by comparing the GCC CM3 port.c and portmacro.h with their CM0 equivalents.
The main difference is going to be in the assembly code used to context switch because the CM0 needs to access the 'high' registers separately from the 'low' registers, whereas the CM3 just accesses (that is, pushes and pops) all the registers at once.Regards.RE: Port from CM3 to CM0 ProblemsPosted by
on May 30, 2013Thanks Richard.
I ported this to CM0.
Seems to work although I haven't done an exhaustive test suite on it.
If somebody wants the code, happy to post it.RE: Port from CM3 to CM0 ProblemsPosted by
on July 25, 2013Hi blindeye2,I porting FreeRTOS to Cortex-M0 with Keil, and I'm stuck at the same problem as you. You offered to post your solution/code, I would be happy to see how you solved the Keil assembly problem.Thanks,ErichRE: Port from CM3 to CM0 ProblemsPosted by
on July 25, 2013Hi Erich,I'm currently traveling and don't have access to the codebase.
I'll try to get to this in the next couple of days.
Is it possible to upload files to this forum?
If not please send me an email address I can send them to.RE: Port from CM3 to CM0 ProblemsPosted by
on July 25, 2013Regrettably it is not possible to upload code directly in this forum.
However, if you can upload code in the Interactive site (http://interactive.freertos.org), then post a link here.Regards.RE: Port from CM3 to CM0 ProblemsPosted by
on July 25, 2013Hi blindEye2,ok, thanks for your offer. You might simply copy-paste your assembly code to reply. I think all the magic is in your implementation of vPortSVCHandler() and vPortSVCHandler(), so should be fairly short assembly code.I'll work until then if I can resolve the thing myself, just in case.Thanks!ErichRE: Port from CM3 to CM0 ProblemsPosted by
on July 25, 2013Ok, I got it sorted out :-)Still need some testing, but below is the code working with Keil and Cortex-M0+./*-----------------------------------------------------------*/__asm void vPortStartFirstTask(void) {
/* Use the NVIC offset register to locate the stack. */
ldr r0, =0xE000ED08
ldr r0, [r0]
ldr r0, [r0]
/* Set the msp back to the start of the stack. */
msr msp, r0
/* Globally enable interrupts. */
/* Call SVC to start the first task. */
nopnop}/*-----------------------------------------------------------*/__asm void vPortSVCHandler(void) {
IMPORT pxCurrentTCB
/* Get the location of the current TCB. */
ldr r3, =pxCurrentTCB
/* Restore the context. */
ldr r1, [r3]
/* Use pxCurrentTCBConst to get the pxCurrentTCB address. */
ldr r0, [r1]
/* The first item in pxCurrentTCB is the task top of stack. */
adds r0, #16
/* Move to the high registers. */
ldmia r0!, {r4-r7}
/* Pop the high registers. */
mov r8, r4
mov r9, r5
mov r10, r6
mov r11, r7
msr psp, r0
/* Remember the new top of stack for the task. */
subs r0, #32
/* Go back for the low registers that are not automatically restored. */
ldmia r0!, {r4-r7}
/* Pop low registers.
mov r1, r14
/* OR R14 with 0x0d. */
movs r0, #0x0d
orrs r1, r0
bx r1}/*-----------------------------------------------------------*/__asm void vPortPendSVHandler(void) {
EXTERN pxCurrentTCBIMPORT vTaskSwitchContext
mrs r0, psp
ldr r3, =pxCurrentTCB
/* Get the location of the current TCB. */
ldr r2, [r3]
subs r0, #32
/* Make space for the remaining low registers. */
str r0, [r2]
/* Save the new top of stack. */
stmia r0!, {r4-r7}
/* Store the low registers that are not saved automatically. */
mov r4, r8
/* Store the high registers. */
mov r5, r9
mov r6, r10
mov r7, r11
stmia r0!, {r4-r7}
push {r3, r14}
bl vTaskSwitchContext
pop {r2, r3}
/* lr goes in r3. r2 now holds tcb pointer. */
ldr r1, [r2]
ldr r0, [r1]
/* The first item in pxCurrentTCB is the task top of stack. */
adds r0, #16
/* Move to the high registers. */
ldmia r0!, {r4-r7}
/* Pop the high registers. */
mov r8, r4
mov r9, r5
mov r10, r6
mov r11, r7
msr psp, r0
/* Remember the new top of stack for the task. */
subs r0, #32
/* Go back for the low registers that are not automatically restored. */
ldmia r0!, {r4-r7}
/* Pop low registers.
bx r3}I'm working on some details, as well supporting M4 with and without floating point unit.Erich1891人阅读
经验总结(73)
debian(18)
我在机器A上编译suricata成功,且在机器A上能正常运行suricata;如果把在机器A上编译的suricata拷贝到机器B上运行,就会报错:Illegal instruction。这让我百思不得其解,随后上网苦找了一番资料,介绍“Illegal instruction”错误的文章也不少,其中有一点说到了我这种情况,那就是CPU架构选择的选项“-march”。
于是我查看了下我编译suricata时的选项,其中并没有指定-march选项,随后我又关注了make时的日志,下面是部分日志:
gcc -DHAVE_CONFIG_H -I. -I..
-I../libhtp
-I/usr/include -I/usr/include/nspr -I/usr/include/nss/ -I/usr/local/include/luajit-2.0/ -DLOCAL_STATE_DIR=\&/var\& -O2 -DRELEASE -Wextra -Werror-implicit-function-declaration -D_GNU_SOURCE -fno-tree-pre -Wall -fno-strict-aliasing -Wno-unused-parameter -std=gnu99 -march=native -DNFQ -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H
-I/usr/include -DLIBPCAP_VERSION_MAJOR=1 -DHAVE_PCAP_SET_BUFF -DHAVE_LIBCAP_NG -MT alert-unified2-alert.o -MD -MP -MF .deps/alert-unified2-alert.Tpo -c -o alert-unified2-alert.o alert-unified2-alert.c
mv -f .deps/alert-unified2-alert.Tpo .deps/alert-unified2-alert.Po
gcc -DHAVE_CONFIG_H -I. -I..
-I../libhtp
-I/usr/include -I/usr/include/nspr -I/usr/include/nss/ -I/usr/local/include/luajit-2.0/ -DLOCAL_STATE_DIR=\&/var\& -O2 -DRELEASE -Wextra -Werror-implicit-function-declaration -D_GNU_SOURCE -fno-tree-pre -Wall -fno-strict-aliasing -Wno-unused-parameter -std=gnu99 -march=native -DNFQ -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H
-I/usr/include -DLIBPCAP_VERSION_MAJOR=1 -DHAVE_PCAP_SET_BUFF -DHAVE_LIBCAP_NG -MT app-layer.o -MD -MP -MF .deps/app-layer.Tpo -c -o app-layer.o app-layer.c
mv -f .deps/app-layer.Tpo .deps/app-layer.Po
gcc -DHAVE_CONFIG_H -I. -I..
-I../libhtp
-I/usr/include -I/usr/include/nspr -I/usr/include/nss/ -I/usr/local/include/luajit-2.0/ -DLOCAL_STATE_DIR=\&/var\& -O2 -DRELEASE -Wextra -Werror-implicit-function-declaration -D_GNU_SOURCE -fno-tree-pre -Wall -fno-strict-aliasing -Wno-unused-parameter -std=gnu99 -march=native -DNFQ -DHAVE_LIBNET11 -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD -DHAVE_NET_ETHERNET_H
-I/usr/include -DLIBPCAP_VERSION_MAJOR=1 -DHAVE_PCAP_SET_BUFF -DHAVE_LIBCAP_NG -MT app-layer-dcerpc.o -MD -MP -MF .deps/app-layer-dcerpc.Tpo -c -o app-layer-dcerpc.o app-layer-dcerpc.c
mv -f .deps/app-layer-dcerpc.Tpo .deps/app-layer-dcerpc.Po
其中就指定-march=native,而该选项的意思是:
‘native’This selects the CPU to generate code for at compilation time by determining the processor type of the compiling machine. Using&-march=native&enables all instruction subsets supported by the local machine
(hence the result might not run on different machines). Using-mtune=native&produces code optimized for the local machine under the constraints of the selected instruction set.
有关-march=cpu-type的更多信息请移步:
这里就说到,-march=native选项使本地机器支持所有的指令集(因此可能导致在不同的机器上不能运行),这也就是为什么在机器A上编译的suricata在机器A上运行没问题,在机器B上运行就会报错了。
那么如何解决这个问题呢?我们可以查看下suricata的configure的选项:
root@joe:/install/suricata# ./configure -h
`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.
See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help
display this help and exit
--help=short
display options specific to this package
--help=recursive
display the short help of all the included packages
-V, --version
display version information and exit
-q, --quiet, --silent
do not print `checking ...' messages
--cache-file=FILE
cache test results in FILE [disabled]
-C, --config-cache
alias for `--cache-file=config.cache'
-n, --no-create
do not create output files
--srcdir=DIR
find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX
install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX
install architecture-dependent files in EPREFIX
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.
You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR
user executables [EPREFIX/bin]
--sbindir=DIR
system admin executables [EPREFIX/sbin]
--libexecdir=DIR
program executables [EPREFIX/libexec]
--sysconfdir=DIR
read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR
modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR
modifiable single-machine data [PREFIX/var]
--libdir=DIR
object code libraries [EPREFIX/lib]
--includedir=DIR
C header files [PREFIX/include]
--oldincludedir=DIR
C header files for non-gcc [/usr/include]
--datarootdir=DIR
read-only arch.-independent data root [PREFIX/share]
--datadir=DIR
read-only architecture-independent data [DATAROOTDIR]
--infodir=DIR
info documentation [DATAROOTDIR/info]
--localedir=DIR
locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR
man documentation [DATAROOTDIR/man]
--docdir=DIR
documentation root [DATAROOTDIR/doc/PACKAGE]
--htmldir=DIR
html documentation [DOCDIR]
--dvidir=DIR
dvi documentation [DOCDIR]
--pdfdir=DIR
pdf documentation [DOCDIR]
--psdir=DIR
ps documentation [DOCDIR]
Program names:
--program-prefix=PREFIX
prepend PREFIX to installed program names
--program-suffix=SUFFIX
append SUFFIX to installed program names
--program-transform-name=PROGRAM
run sed PROGRAM on installed program names
System types:
--build=BUILD
configure for building on BUILD [guessed]
--host=HOST
cross-compile to build programs to run on HOST [BUILD]
Optional Features:
--disable-option-checking
ignore unrecognized --enable/--with options
--disable-FEATURE
do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG]
include FEATURE [ARG=yes]
--disable-dependency-tracking
speeds up one-time build
--enable-dependency-tracking
do not reject slow dependency extractors
--enable-shared[=PKGS]
build shared libraries [default=yes]
--enable-static[=PKGS]
build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock
avoid locking (might break parallel builds)
--disable-largefile
omit support for large files
--enable-gccprotect
Detect and use gcc hardening options
--enable-gccprofile
Enable gcc profile info i.e -pg flag is set
--enable-gccmarch-native
Enable gcc march=native gcc 4.2 and later only
--enable-unittests
Enable compilation of the unit tests
--enable-old-barnyard2
Use workaround for old barnyard2 in unified2 output
--enable-debug
Enable debug output
--enable-debug-validation
Enable (debug) validation code output
--enable-profiling
Enable performance profiling
--enable-profiling-locks
Enable performance profiling for locks
--enable-ipfw
Enable FreeBSD IPFW support for inline IDP
--enable-unix-socket
Enable unix socket [default=test]
--enable-nfqueue
Enable NFQUEUE support for inline IDP
--enable-prelude
Enable Prelude support for alerts
--enable-pfring
Enable Native PF_RING support
--enable-af-packet
Enable AF_PACKET support [default=yes]
--enable-non-bundled-htp
Enable the use of an already installed version of
--enable-cuda
Enable experimental CUDA pattern matching
--enable-dag
Enable DAG capture
--enable-napatech
Enabled Napatech Devices
--enable-luajit
Enable Luajit support
--enable-geoip
Enable GeoIP support
Optional Packages:
--with-PACKAGE[=ARG]
use PACKAGE [ARG=yes]
--without-PACKAGE
do not use PACKAGE (same as --with-PACKAGE=no)
--with-pic[=PKGS]
try to use only PIC/non-PIC objects [default=use
--with-gnu-ld
assume the C compiler uses GNU ld [default=no]
--with-sysroot=DIR Search for dependent libraries within DIR
(or the compiler's sysroot if not specified).
--with-libpcre-includes=DIR
libpcre include directory
--with-libpcre-libraries=DIR
libpcre library directory
--with-libyaml-includes=DIR
libyaml include directory
--with-libyaml-libraries=DIR
libyaml library directory
--with-libpthread-includes=DIR
libpthread include directory
--with-libpthread-libraries=DIR
libpthread library directory
--with-libjansson-includes=DIR
libjansson include directory
--with-libjansson-libraries=DIR
libjansson library directory
--with-libnfnetlink-includes=DIR
libnfnetlink include directory
--with-libnfnetlink-libraries=DIR
libnfnetlink library directory
--with-libnetfilter_queue-includes=DIR
libnetfilter_queue include directory
--with-libnetfilter_queue-libraries=DIR
libnetfilter_queue library directory
--with-netfilterforwin-includes=DIR
netfilterforwin include directory
--with-libnetfilter_conntrack-includes=DIR
libnetfilter_conntrack include directory
--with-libnetfilter_conntrack-libraries=DIR
libnetfilter_conntrack library directory
--with-libprelude-prefix=PFX
Prefix where libprelude is installed (optional)
--with-libnet-includes=DIR
libnet include directory
--with-libnet-libraries=DIR
libnet library directory
--with-libpfring-includes=DIR
libpfring include directory
--with-libpfring-libraries=DIR
libpfring library directory
--with-libpcap-includes=DIR
libpcap include directory
--with-libpcap-libraries=DIR
libpcap library directory
--with-libhtp-includes=DIR
libhtp include directory
--with-libhtp-libraries=DIR
libhtp library directory
--with-cuda-includes=DIR
cuda include directory
--with-cuda-libraries=DIR
cuda library directory
--with-cuda-nvcc=DIR
cuda nvcc compiler directory
--with-libcap_ng-includes=DIR
libcap_ng include directory
--with-libcap_ng-libraries=DIR
libcap_ng library directory
--with-dag-includes=DIR
dagapi include directory
--with-dag-libraries=DIR
dagapi library directory
--with-libnspr-includes=DIR
libnspr include directory
--with-libnspr-libraries=DIR
libnspr library directory
--with-libnss-includes=DIR
libnss include directory
--with-libnss-libraries=DIR
libnss library directory
--with-libmagic-includes=DIR
libmagic include directory
--with-libmagic-libraries=DIR
libmagic library directory
--with-napatech-includes=DIR
napatech include directory
--with-napatech-libraries=DIR
napatech library directory
--with-libluajit-includes=DIR
libluajit include directory
--with-libluajit-libraries=DIR
libluajit library directory
--with-libgeoip-includes=DIR
libgeoip include directory
--with-libgeoip-libraries=DIR
libgeoip library directory
Some influential environment variables:
C compiler command
C compiler flags
linker flags, e.g. -L&lib dir& if you have libraries in a
nonstandard directory &lib dir&
libraries to pass to the linker, e.g. -l&library&
(Objective) C/C++ preprocessor flags, e.g. -I&include dir& if
you have headers in a nonstandard directory &include dir&
C preprocessor
PKG_CONFIG
path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
LIBHTPMINVERSION_CFLAGS
C compiler flags for LIBHTPMINVERSION, overriding pkg-config
LIBHTPMINVERSION_LIBS
linker flags for LIBHTPMINVERSION, overriding pkg-config
LIBHTPMAXVERSION_CFLAGS
C compiler flags for LIBHTPMAXVERSION, overriding pkg-config
LIBHTPMAXVERSION_LIBS
linker flags for LIBHTPMAXVERSION, overriding pkg-config
LUAJIT_CFLAGS
C compiler flags for LUAJIT, overriding pkg-config
LUAJIT_LIBS linker flags for LUAJIT, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Report bugs to the package provider.
其中有一个选项:--enable-gccmarch-native,会默认指定-march=native。
所以我们要在configure的时候使用--disable-gccmarch-native选项就可以不指定-march=native。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:337552次
积分:3445
积分:3445
排名:第7158名
原创:49篇
转载:31篇
评论:56条
(1)(1)(2)(1)(2)(1)(1)(2)(4)(1)(2)(1)(4)(6)(9)(5)(4)(10)(3)(2)(2)(7)(1)(1)(2)(1)(6)(2)

我要回帖

更多关于 edge preserving 的文章

 

随机推荐