armcc

arm compiler 5 do not fully respect volatile qualifier

瘦欲@ 提交于 2021-02-19 02:59:27
问题 Consider the following code: volatile int status; status = process_package_header(&pack_header, PACK_INFO_CONST); if ((((status) == (SUCCESS_CONST)) ? ((random_delay() && ((SUCCESS_CONST) == (status))) ? 0 : side_channel_sttack_detected()) : 1)) { ... } Which generates this machine code (produced with the toolchain's objdump ): 60: f7ff fffe bl 0 <process_package_header> 64: 9000 str r0, [sp, #0] /* <- storing to memory as status is volatile */ 66: 42a0 cmp r0, r4 /* <- where is the load

What is the use of __packed attribute in function arguments

。_饼干妹妹 提交于 2020-07-07 07:15:28
问题 int readint(__packed int *data) { return *data; } I have seen __packed attribute in struct declarations to avoid padding. However, what is the benefit of using __packed attribute in function arguments. The author says that he has used __packed to tell the compiler that the integer may possibly not be aligned. What does it means? Edit: Will the following work with gcc compiler int readint(__attribute__((packed)) int *data) { return *data; } 回答1: The __packed qualifier is a compiler-specific

GNU-Make does not recompile when a header file changed

泪湿孤枕 提交于 2020-01-23 08:58:32
问题 GNU-Make does not recompile when hdr.h file changed. As below printed lines, it did not try to recompile even main.d file is generated. Can you guide me why it happend? hdr.h #ifndef __HDR_H__ #define LOOP_CNT 1000 #endif /* __HDR_H__ */ main.c #include <stdio.h> #include "hdr.h" int main(void) { int i, sum = 0; for (i = 0; i < LOOP_CNT; i++) sum += i; (void)printf("sum = %d\n", sum); return 0; } Makefile SUFFIXES += .d .PHONY: clean OBJECTS = $(patsubst %.c,%.o,$(wildcard *.c)) CC = armcc LD

GNU-Make does not recompile when a header file changed

偶尔善良 提交于 2020-01-23 08:58:21
问题 GNU-Make does not recompile when hdr.h file changed. As below printed lines, it did not try to recompile even main.d file is generated. Can you guide me why it happend? hdr.h #ifndef __HDR_H__ #define LOOP_CNT 1000 #endif /* __HDR_H__ */ main.c #include <stdio.h> #include "hdr.h" int main(void) { int i, sum = 0; for (i = 0; i < LOOP_CNT; i++) sum += i; (void)printf("sum = %d\n", sum); return 0; } Makefile SUFFIXES += .d .PHONY: clean OBJECTS = $(patsubst %.c,%.o,$(wildcard *.c)) CC = armcc LD

What's the structure of .arm.extab entry in armcc?

喜欢而已 提交于 2019-12-23 21:00:29
问题 I'm trying to understand exactly how the exception table (.arm.extab) works. I'm aware that this is compiler dependent, so i'll restrict myself to armcc (as i'm using Keil). A typical entry in the table looks something like: b0aa0380 2a002c00 01000000 00000000 To my understanding, the first word encodes instructions for the personality routine, while the third word is a R_ARM_PREL31 relocation to the start of the catch block. What baffles me is the second word - it appears to be split into 2

how to link the openssl library with the arm-cross compiler

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 04:27:08
问题 I have application test.c which by using gcc on host(on ubuntu) machine i have succeed in compilation and successfully ran the application program on host. now I would like to cross compile the same application with arm-cross compiler for LPC1788 . please guide me how to link the openssl library files My Mkakefile with GCC CC = gcc CFLAGS = -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_XKMS=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -DXMLSEC_OPENSSL

How to prevent LDM/STM instructions expansion in ARM Compiler 5 armcc inline assembler?

非 Y 不嫁゛ 提交于 2019-12-14 03:54:05
问题 I'm trying to generate AXI bus burst accesses using STM/LDM instructions in inline assembly in .c file compiled with ARM Compiler 5 armcc. inline void STMIA2(uint32_t addr, uint32_t w0, uint32_t w1) { __asm { STMIA addr!, { w0, w1 } } } But ARM Compiler armcc User Guide, paragraph 7.18 is saying: "All LDM and STM instructions are expanded into a sequence of LDR and STR instructions with equivalent effect. However, the compiler might subsequently recombine the separate instructions into an LDM

Eigen on ARM Cortex M3 with armcc

纵饮孤独 提交于 2019-12-08 04:13:46
问题 I'm trying to use Eigen library with armcc compiler using Keil for Cortex M3 target and I get compilation error: Eigen/src/Core/Transpositions.h(387): error: #135: class template "Eigen::Transpose<Eigen::TranspositionsBase<Derived>>" has no member "derived" It comes from this code: class Transpose<TranspositionsBase<TranspositionsDerived> > { typedef TranspositionsDerived TranspositionType; typedef typename TranspositionType::IndicesType IndicesType; public: explicit Transpose(const

how to link the openssl library with the arm-cross compiler

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 03:48:01
I have application test.c which by using gcc on host(on ubuntu) machine i have succeed in compilation and successfully ran the application program on host. now I would like to cross compile the same application with arm-cross compiler for LPC1788 . please guide me how to link the openssl library files My Mkakefile with GCC CC = gcc CFLAGS = -D__XMLSEC_FUNCTION__=__FUNCTION__ -DXMLSEC_NO_XKMS=1 -DXMLSEC_NO_CRYPTO_DYNAMIC_LOADING=1 -I/usr/include/xmlsec1 -I/usr/include/libxml2 -DXMLSEC_OPENSSL_097=1 -DXMLSEC_CRYPTO_OPENSSL=1 -DXMLSEC_CRYPTO=\"openssl\ -DUNIX_SOCKETS -D XML_SECURITY LDFLAGS =