embedded

Writing AT commands embedded linux

旧巷老猫 提交于 2019-12-24 01:42:27
问题 I am having issues writing AT commands to a GSM module. It works flawless when i use minicom -b 115200 -D /dev/ttySP0 --term=vt100 But i cant figure out how to do the same thing in C code. I do not receive any errors, but the module does no react to the commands. Anyone know what could be wrong? #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <termios.h> #include <stdio.h> #define BAUDRATE B115200 #define COM1 "/dev/ttySP0" static int fd; static struct termios oldtio

Embedded console log optimization

烈酒焚心 提交于 2019-12-24 00:14:26
问题 A while back I had posted this question on SO. In that question I was looking for a way to implement a solution which we had thought of. But from the answers I got, I saw that that solution was unimplementable using the default C preprocessor. So I've decided to post the problem directly and see if a proper solution can be found. PROBLEM STATEMENT We have a custom hardware platform on which we've used the Contiki OS to build the firmware. The hardware is based on the MSP430 micro-controller.

build for ARMv6 with gnueabihf

浪子不回头ぞ 提交于 2019-12-23 23:37:49
问题 I try to build an app for ARMv6 but, fail. I guess the problem is the Toolchain which supports Hard Float but, ARMv6 does not. Well, first i set -march=armv6, where compilation fails. /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h: In function ‘__bswap_32’: /opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.03_linux/arm-linux-gnueabihf/libc/usr/include/bits/byteswap.h:45:1: sorry, unimplemented: Thumb-1 hard-float VFP ABI Additionally, i

Aligned vs. Packed attributes

纵然是瞬间 提交于 2019-12-23 19:00:30
问题 I am working on firmware for a 16-bit PIC and writing in C (Microchip C30 compiler). My device receives a long list of bytes from an external device, and then I am trying to copy those bytes into a structure. The structure is defined as follows: typedef struct __attribute__((__packed__)) { char F1Nickname[17]; char F2Nickname[17]; DWORD F1CurrentPos; DWORD F2CurrentPos; WORD F1CurrentTemp; WORD F2CurrentTemp; DWORD F1MaxPos; DWORD F2MaxPos; BYTE F1TempCompOn; BYTE F2TempCompOn; BYTE CheckSum;

Most efficient way to match (a few) strings in C?

半世苍凉 提交于 2019-12-23 18:23:16
问题 Our system needs to accept user input from a terminal and match against a few known keyword strings (maybe 10). We don't have the space/computrons to do regexp etc., code needs to be tiny & quick. Now, the nasty way to do this is: // str is null-terminated, assume we know it's safe/sane here if(!strncmp(str,"hello",5) { do_hello(); } else if(!strncmp(str,"world",5) { do_world(); } else { meh(); // Wasn't a match } So, after a bit of googling & reading I'm being convinced that a nicer way is

Error: bad value for -march= switch

筅森魡賤 提交于 2019-12-23 13:01:16
问题 I wrote a Makefile and I can't get it to work. I have an option which is supposed to select which processor to compile to. However, when I run make from the commandline it says: tandex@tandex-P-6860FX:~/emulators/nintendo sdks/3DS SDK [HomeBrew]$ make gcc -march=arm7tdmi -static -fexceptions -fnon-call-exceptions -fstack-check test.c -c test.c:1:0: error: bad value (arm7tdmi) for -march= switch make: *** [ALL] Error 1 But in the man pages for gcc, it states that arm7tdmi is a permissible

Qt : send Key_Return and Key_Delete events

余生长醉 提交于 2019-12-23 12:34:12
问题 I am developing a virtual keyboard with Qt Embedded, and I'm confronted with a little problem. In fact, I use SignalMappers to map the key to keyboard events in order to display text in a QTextEdit widget. Everything works fine, except for two events : Key_Return and Key_Delete ; I have no idea what I'm doing wrong, maybe you'll have an idea. Here is a classical code, to send chars : void VirtualKeyboard::SendChar( int index ) { QChar charToSend( letters_.at( index )->text().at( 0 ) ); // Get

Fixed allocation std::vector

99封情书 提交于 2019-12-23 12:25:44
问题 I'm an embedded software developer and as such I can't always use all the nice C++ features. One of the most difficult things is avoiding dynamic memory allocation as it is somewhat universal with all STL containers. The std::vector is however very useful when working with variable datasets. The problem though is that the allocation(e.g. std::reserve ) isn't done at initialization or fixed. This means that memory fragmentation can occur when a copy occurs. It would be great to have every

Linker Script: Put a particular file at a later position

浪尽此生 提交于 2019-12-23 06:06:38
问题 I'd like to write a linker script looking something like this: SECTIONS { . = 0x0; .startup . : { startup.o(.text) } .text : { *(.text) } .data : { *(.data) } .bss : { *(.bss COMMON) } . = 0x4000; other.text : { other.o(.text) } other.data : { other.o(.data) } other.bss : { other.o(.bss) } } My intention here is to have, in this order: a section with the .text from startup.o .text , .data and .bss containing those sections from all other input files besides other.o the .text , .data and .bss

omap_udc.c g_hid.c hid gadget on beagleboard with angstrom linux

半腔热情 提交于 2019-12-23 05:17:54
问题 To use the beagleboard xm as an HID peripheral I plan to do the following: Discover how to build things with angstrom. Get the kernel source 2.6.32. Compile omap_udc and g_hid Insert those modules into the kernel Compile the example from gadget_hid.txt Send keyboard commands with hid_gadget_test /dev/hidg0 keyboard Is that a good way to do what I want? http://www.edaboard.com/thread145675.html is a somewhat related issue from '09. Looking for Example Embedded Linux HID Device Code is very