embedded

How do I resolve a “section type conflict” compile error and best practices for using section attribute with gcc

北慕城南 提交于 2019-12-10 18:04:10
问题 I am using Android NDKr8 and by extension gcc to compile some library code that is shared across multiple platforms including some embedded ones. This code uses segments to put a bunch of elements into a contiguous memory space. The compile is generating a "error: variable_name causes a section type conflict". We use a macro to declare the segment attribute: # define DB_SEGMENT __attribute__ ((__section__ ("DBSegment"))) The above variable_name is declared as follows: dbStruct const variable

Small file not committed to disk for over a minute

不打扰是莪最后的温柔 提交于 2019-12-10 17:34:30
问题 I have an embedded Linux app that writes to a file at a fairly slow rate ( 50 bytes/s or so). The file is on a hard drive, XFS filesystem. The file is being written to by calling write() , not fwrite() . If I power-cycle the system and check the file, over a minute's worth of data is missing. I thought the default Linux behaviour was to sync the disk cache every 5s (I can tolerate 5s worth of missing data so they'd be no problem with this). What should I be checking to see why it isn't

How to check if uint8_t exists as a type, instead of unsigned char?

本秂侑毒 提交于 2019-12-10 17:12:15
问题 I have two compilers, one that recognizes uint8_t(GCC ARM-EABI), and one that doesn't(Renesas M16 Standard Toolchain). The Renesas Toolchain is NOT ANSI C compliant, so you can throw out . So uint8_t, uint16_t,... aren't defined as existing types. In order to maintain portability, I would like to have the same types(preferably uint8_t, due to the ambiguity of int). Also my platforms are different size processors(ARM is 32 bit, and Renesas is 16 bit). Causing int to be different values. Is

Linux kernel driver

佐手、 提交于 2019-12-10 17:11:34
问题 This question was migrated from Unix & Linux Stack Exchange because it can be answered on Stack Overflow. Migrated 2 years ago . I'm learning how to develop a simple driver for a card connected to the USB1 serial. I wanted to know how the kernel understand that my device needs to be mapped as /dev/ebbchar. How to change to /dev/ebbGV? and if i connect another device why i dont view /dev/ebbchar but /dev/tty0? thanks. In short how kernel do to understand that board connect to USB1 is ebbchar

ARM C++ - how to put const members in flash memory?

橙三吉。 提交于 2019-12-10 16:39:28
问题 I have this code class IO { public: IO(LPC_GPIO_TypeDef* port, int pin) : _pin(pin), _port(port) {}; const int _pin; LPC_GPIO_TypeDef* const _port; void test() { LPC_GPIO0->FIOSET = 0; } }; IO led1(LPC_GPIO0, 5); int main() { led1.test(); return 0; } When i compile it i get text data bss dec hex filename 656 0 8 664 298 lpc17xx I'd expect const _port and _pin variables be stored in flash since they are marked const and initialization values are known at compile time, but they are allocated in

Portable function in C (with no assembly) that returns the size of its stack frame

江枫思渺然 提交于 2019-12-10 16:33:31
问题 Write a portable function in C (with no assembly) that returns the size of its stack frame int stackframe_size() { } Attempted solving it as below - This function returns 228 bytes when compiled with VS 2010. Is there a way to verify its correctness? int stackframe_size(int run) { int i ; if(!run) { return ((int)(&i) - stackframe_size(++run)); } return (int)(&i); } Invoked as: int main() { printf("\nSize of stackframe_size() is: %d bytes",stackframe_size(0)) ; return 0; } 回答1: No such

BRAM_INIT in VHDL

≯℡__Kan透↙ 提交于 2019-12-10 16:18:20
问题 I am simulating a processor based design where the program memory contents are held in a BRAM. I am realizing the program memory using VHDL (inferring BRAMs). I am trying to avoid CoreGen because I want to keep the design portable. Eventually this design will go to an FPGA. I am looking to see if there is a way to initialize memory contents of the BRAMs using VHDL generics ? I understand that Coregen uses COE file to initialize the BRAM but do we have a VHDL code based way to do this ? Let me

Dump Flash Memory through a single GPIO pin

喜你入骨 提交于 2019-12-10 16:06:00
问题 I'm working with Infineon's XMC4500 Relax Kit and I'm trying to extract the firmware through a single GPIO pin. My very naive idea is to dump one bit at a time through the GPIO pin and somehow "sniff" the data with a logic analyzer. Pseudocode: while(word by word memory copy hasn't finished) ... register = value; temp_value = value AND 0x1; pin = temp_value; value = value >> 1; ... Am I on the right track? Does anybody have a better/nicer idea how to archive this? ### EDIT ### Actually a

Efficient way to wait for an interrupt in C

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 15:59:46
问题 I am using WiringPi on a raspberry pi. With it I assign an interrupt function which is called later. I'm not sure what to do when waiting for the interupt to be called. Examples use a (spinlock?) for (;;) e.g. int main() { // register interrupt wiringPiISR( 18, INT_EDGE_BOTH, &myInterrupt ); for (;;) { // really? } return 0; } And I noticed that sleep works too. The interrupt is called regardless of the sleep int main() { // register interrupt wiringPiISR( 18, INT_EDGE_BOTH, &myInterrupt );

Web technologies for an embedded server

依然范特西╮ 提交于 2019-12-10 15:01:19
问题 I've recently started a new web development project for an embedded device and wanted to solicit some recommendations for technologies to use. The device will serve HTML pages which include AJAX code to retrieve data from a JSON server. We're tentatively using Cherokee as the web server, though we're not tied to it. Currently, I'm considering the following technologies: Write it all in PHP. I know it's big, slow, and bloated, but I've got about 10MB available for the web interface (a lot for