embedded

Convert Raw 14 bit Two's Complement to Signed 16 bit Integer

为君一笑 提交于 2019-12-08 15:38:39
问题 I am doing some work in embedded C with an accelerometer that returns data as a 14 bit 2's complement number. I am storing this result directly into a uint16_t . Later in my code I am trying to convert this "raw" form of the data into a signed integer to represent / work with in the rest of my code. I am having trouble getting the compiler to understand what I am trying to do. In the following code I'm checking if the 14th bit is set (meaning the number is negative) and then I want to invert

Cross compile PHP [closed]

好久不见. 提交于 2019-12-08 14:58:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I have downloaded the PHP 5.4.0 source, extracted it and moved into the source folder. I do a configure with: ./configure --build=x86_64-unknown-linux-gnu --host=arm-linux-uclibcgnueabi --prefix=/usr/arm/www CC="arm-linux-uclibcgnueabi-gcc --sysroot=/toolchains/gnu_cortex-a9_tools/" --disable-libxml --disable

Bug related to UART FIFO under multi-tasks

拥有回忆 提交于 2019-12-08 14:10:38
问题 Program attached: Those codes are written by me based on the TI uart.c driver library. while(1){ //check if message on Queue -> read or check UART input if(uxQueueMessagesWaiting( UART_TASKQ ) != 0){ //may have bugs // deQueue xQueueReceive( UART_TASKQ, &UARTTaskHandle, 0x0A ); //do the task's mission using the data in the stucture(put by control task) //Print out the input data. //**********debugging data /* testPointer = UARTTaskHandle->dataBuffer; testAmount = UARTTaskHandle->dataSize;

Want to Convert Integer to String without itoa function

主宰稳场 提交于 2019-12-08 13:46:39
问题 i want to convert int to char * in C without using itoa() function. Because on my Linux Systems i itoa function is not there. i am using this code which i found from here I want to run this function on Embedded devices also which are using Linux. So i am looking for without use of itoa . I dnt want to use sprintf also because its uses for just prints. So any body please help me to figured out this problem. Thanks 回答1: Thing is snprintf is the perfect function for this: char str[LEN]; snprintf

How to pass native event handler for interrupt in state pattern code

↘锁芯ラ 提交于 2019-12-08 11:26:26
问题 I've turned to state pattern for my netmf project. Something based on this: http://www.dofactory.com/Patterns/PatternState.aspx#_self2 I have a rotary encoder knob that will act differently in each state. I've been trying to wrap my head around this and can't get anything to work on my end. I'm not sure where and how to inject the interrupt handler into each state and how to invoke the switch of the interrupt handler. Without the State Pattern the code looks something like: RotaryEncoder RE =

How to build when multiple source files in rootfs in embedded linux?

戏子无情 提交于 2019-12-08 11:00:19
问题 This question was migrated from Unix & Linux Stack Exchange because it can be answered on Stack Overflow. Migrated 2 years ago . I have a simple c application Ctest.c file #include <stdio.h> #include "new.h" #include "new.c" int main() { switching(); return 0; } and i have those new.c and new.h files. new.h file as void switching(); and my new.c file as void switching(){ char grade ='B'; switch(grade){ case 'A': printf("Excellent\n"); break; case 'B': printf("Super\n"); break; case 'C':

How to pass a bitfield (by reference) to a function?

我怕爱的太早我们不能终老 提交于 2019-12-08 08:19:28
My question is how to pass a bitfield instance by reference to a function. I have performed this as shown below, but when i eneter the function DAC_set_gain_code, the processor throws an interupt fault. Is what i am doing correct as far as passing the bitfield goes? I have created a bitfield (see below) which represents a 24bit register on an DAC chip, which i want to write into and lives in the .h file. typedef struct { uint8_t rdwr_u8: 1; uint8_t not_used_u8: 3; uint8_t address_u8: 4; uint8_t reserved_u8: 8; uint8_t data_u8: 8; }GAIN_REG_st; I have a function which initialises the bitfield

Best scripting language for cross compiling to ARM

筅森魡賤 提交于 2019-12-08 06:29:28
I am looking for the "best" scripting language interpreter for cross compiling to an ARM processor. Here are the requirements for "best": Its small. Ideally, I'd like to be able to decide which parts of the language and "standard" libraries that are supported. (For instance: file system, nah don't want that. Floating point math, nope don't want that either.) Its easy. Ideally, I'd like some documentation/tutorial/examples on how to do the cross-compile. The goal: I'm writing a small, simple web server in an embedded ARM device and I'd like to do some string processing easily. The code is

How is the CSR signature constructed?

[亡魂溺海] 提交于 2019-12-08 06:09:08
问题 I am trying to generate a CSR (Certificate Signing Request) in an embedded device. I have implemented some OpenSSL functions in one embedded device. Unfortunately I only have a few functions available. So far I've been able to generate an RSA private key and now I need to generate the CSR. My library does NOT have any of the functions such as X509_REQ_new() , X509_REQ_get_subject_name() etc. Therefore I'm building the CSR by means of creating a DER file directly. The CSR in DER format is

How to specify a memory location at which function will get stored?

ⅰ亾dé卋堺 提交于 2019-12-08 05:45:25
问题 Can anyone please let me know what are the possible ways in which we can store a function(in C) at a fixed memory location. I am using IAR IDE for ARM cortex m3 core. 回答1: How functions and data can be placed in memory is described in section "Controlling data and function placement in memory" of the IAR manual "IAR C/C++ Development Guide". The only way I see to place a specific function at a specific address is to define a section in memory where to place this and only this function.