embedded

Best scripting language for cross compiling to ARM

戏子无情 提交于 2019-12-23 03:16:15
问题 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

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

扶醉桌前 提交于 2019-12-23 02:45:38
问题 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

How to find Logical Name for PinPad XFS if it is not mentioned in Manual

醉酒当歌 提交于 2019-12-23 02:17:13
问题 I have started XFS implementation of SZZT Pinpad .I am facing an issue with the WFSOpen command Its giving an error “ – 14 “which is mentioned as WFS_ERR_HARDWARE_ERROR in the Manual. Please let us know if we are missing out on any parameter Value for the same . Also we are unable to find the logical Name for SZZT Pinpad in the Manual . As of now we are using the same name which is been mentioned in the Registry 回答1: I've had recently this problem. In my case, it was due to the service

Access Memory Mapped I/O

馋奶兔 提交于 2019-12-22 21:29:08
问题 I am very new to embedded system programming, I just need to learn how to manipulate the given via c++ code. Given: Motor 1 is mapped to 0x60000000 Motor 2 is mapped to 0x50000000 the following are the definitions of current 32-bit registers REGISTER NAME | BYTE OFFSET | NOTES ---------------------------------------------------------------------- motor_interrupt 0x00 service interrupts motor_status 0x01 enable on demand access to status elements motor_command 0x02 enable command of the motor

Different results between a 16-bit int machine and a 32-bit int machine in a subtraction

大憨熊 提交于 2019-12-22 18:10:04
问题 When the code below is run against a 16-bit integer machine like MSP430 micro controller, s32 yields 65446 #include <stdint.h> uint16_t u16c; int32_t s32; int main() { u16c = 100U; s32 = 10 - u16c; } My understanding is that 10 - u16c gets implicit type promotion to unsigned int. Mathematically 10 - u16c equals to -90. But how is it possible to represent a negative number as an unsigned int? When -90 gets promoted to unsigned int, does it mean that the sign of a number is ignored? Lets

Different results between a 16-bit int machine and a 32-bit int machine in a subtraction

心已入冬 提交于 2019-12-22 18:09:56
问题 When the code below is run against a 16-bit integer machine like MSP430 micro controller, s32 yields 65446 #include <stdint.h> uint16_t u16c; int32_t s32; int main() { u16c = 100U; s32 = 10 - u16c; } My understanding is that 10 - u16c gets implicit type promotion to unsigned int. Mathematically 10 - u16c equals to -90. But how is it possible to represent a negative number as an unsigned int? When -90 gets promoted to unsigned int, does it mean that the sign of a number is ignored? Lets

How to receive packets on the MCU's serial port?

吃可爱长大的小学妹 提交于 2019-12-22 14:06:14
问题 Consider this code running on my microcontroller unit(MCU): while(1){ do_stuff; if(packet_from_PC) send_data_via_gpio(new_packet); //send via general purpose i/o pins else send_data_via_gpio(default_packet); do_other_stuff; } The MCU is also interfaced to a PC via a UART.Whenever the PC sends data to the MCU, the new_packet is sent, otherwise the default_packet is sent.Each packet can be 5 or more bytes with a pre defined packet structure. My question is: 1.Should i receive the entire packet

Contiki UDP packet transmission duration with CC2538

故事扮演 提交于 2019-12-22 12:33:15
问题 Could someone explain me what is going on within the Contiki-OS when it transmits an UDP packet? Here is the current consumption of my device in details running with the CC2538 chip: My question is: why it takes so long to transmit an UDP broadcast packet (about 250ms) knowing that theoretically at 250kbps the packet of 408 bits length should be transmitted in approximately 2ms? I'd understand if the transmission last lets say ten milliseconds but here the difference is huge. I use the

Compile time float packing/punning

纵然是瞬间 提交于 2019-12-22 10:56:32
问题 I'm writing C for the PIC32MX, compiled with Microchip's PIC32 C compiler (based on GCC 3.4). Added The standard I'm following is GNU99 (C99 with GNU extensions, compiler flag -std=gnu99 ) My problem is this: I have some reprogrammable numeric data that is stored either on EEPROM or in the program flash of the chip. This means that when I want to store a float, I have to do some type punning: typedef union { int intval; float floatval; } IntFloat; unsigned int float_as_int(float fval) {

const value vs. #define, which kind of chip resource will be used?

孤街醉人 提交于 2019-12-22 08:28:45
问题 if I define a macro, or use static const value, in an embedded system, which kind of memory will be used, chip flash or chip ram? Which way is better? 回答1: Well, if you #define a macro, no additional memory or code space (flash) allocated for it. All job done in compile stage. If you use a static const global variable, binary codes will generated for initial value and memory allocated for it. both flash (bin file size bigger) and memory (chip ram) used. 回答2: I believe the answer is more