embedded-linux

how to detect a pin change of a GPIO on Linux board

天涯浪子 提交于 2019-12-04 03:07:02
I am using 3.12 kernel on an ARM based linux board (imx233 CPU). My purpose is to detect pin change of a GPIO (1 to 0). I can read the pin value constantly calling the below function (in a while(1) loop) int GPIO_read_value(int pin){ int gpio_value = 0; char path[35] = {'\0'}; FILE *fp; sprintf(path, "/sys/class/gpio/gpio%d/value", pin); if ((fp = fopen(path,"rb+")) == NULL){ //echo in > direction //error } fscanf(fp, "%d", &gpio_value); fclose(fp); return gpio_value; } But it causes too much load to the CPU. I don't use usleep or nanosleep , because the pin change happens for a very short of

fsync, sync: does it really do what its supposed to? [closed]

一世执手 提交于 2019-12-04 03:01:59
问题 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 6 years ago . I would like to have more clarification on the functionality of sync(8) and fsync functions in Linux (2.6.31). Does it make sure the files are written to the respective storage? 回答1: http://linux.die.net/man/8/sync It does not make sure that files are written to respective storage. It only makes sure that cached

Dynamic languages for embedded devices? [closed]

一世执手 提交于 2019-12-03 16:27:54
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 3 years ago . I need to deploy a dynamic language to a small embedded Linux device, and have difficulty finding the right one: I want to build a small web-application with this language (with a small framework like Sinatra or Camping ) and write some scripts for maintenance. I would prefer Ruby, as I have some experience in it, but after several days of trying to cross-compile

Qemu Freescale i.MX6 DualLite SABRE : root filesystem does not mount

偶尔善良 提交于 2019-12-03 15:00:47
Goal: emulate the "sabrelite : Freescale i.MX6 Quad SABRE Lite Board (Cortex A9)" that Qemu specifically supports (doing 'qemu-system-arm -M ?' it shows up). Qemu ver: 2.10.1 (host: fedora-27). I have successfully cross-compiled and built a 4.1.46 Linux kernel (used the imx_v6_v7_defconfig config file) as well as a simple "skeleton" root filesystem (busybox-based). (FYI, I have a similar working setup for the ARM Cortex-A9 Versatile Express platform - I do this using my own home-spun embedded Linux system called SEALS ). Looking at the U-Boot config file used by similar boards, I figured to

Using RNDADDENTROPY to add entropy to /dev/random

荒凉一梦 提交于 2019-12-03 13:38:52
I have a device which generates some noise that I want to add to the entropy pool for the /dev/random device in an embedded Linux system. I'm reading the man page on /dev/random and I don't really understand the structure that you pass into the RNDADDENTROPY ioctl call. RNDADDENTROPY Add some additional entropy to the input pool, incrementing the entropy count. This differs from writing to /dev/random or /dev/urandom, which only adds some data but does not increment the entropy count. The following structure is used: struct rand_pool_info { int entropy_count; int buf_size; __u32 buf[0]; };

Mouse and Keyboard not working in qemu emulator

放肆的年华 提交于 2019-12-03 13:25:24
问题 I am trying to run Yocto Image in qemu on my Ubuntu laptop with the following command. qemu-system-arm -M overo -m 256 -sd ./test.img -clock unix -serial stdio -device usb-mouse -device usb-kbd Qemu works fine and the image is booted pretty clean, but I am unable to use my keyboard and Mouse. On any key press I get this warning. usb-kbd: warning: key event queue full Any workaround for this unresponsive keyboard? 回答1: The problem was, I need to specify USB bus number with device number for

Is there a way to check the exact list of packages that will be installed in the image in Yocto?

混江龙づ霸主 提交于 2019-12-03 12:47:06
In Yocto-based Embedded Linux distributions, I am really interested in finding the complete list of packages/recipes/kernel modules from each dependent layers that will be built and installed to an image file before executing the image building recipe such as: bitbake my-image-minimal Is there a way to achieve this? Any guidance in this regard is appreciated. Thanks in advance. Yes, like this On old Bitbake versions: bitbake -g <image> && cat pn-depends.dot | grep -v -e '-native' \ | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq Taken from the NXP Community website On

Linux: How to enable Execute in place (XIP) for RAMFS/TMPFS

五迷三道 提交于 2019-12-03 12:41:02
I'm working on an embedded system where the rootfs is constructed in a tmpfs partition by the init process. After the rootfs is complete, it will do a pivot-root and start spawning processes located in the rootfs . But it seems like XIP is not working for our tmpfs , and all the applications is therefore loaded into ram twice (in the tmpfs and again into ram when loaded). Can this really be true? I found an old discussion thread at https://ez.analog.com/thread/45262 which describe the same issue as I'm seeing. How can I achieve XIP for a file-system located in memory? What you are attempting

How to find which Yocto Project recipe populates a particular file on an image root filesystem

时光总嘲笑我的痴心妄想 提交于 2019-12-03 12:21:31
问题 I work with the Yocto Project quite a bit and a common challenge is determining why (or from what recipe) a file has been included on the rootfs. This is something that can hopefully be derived from the build system's environment, log & meta data. Ideally, a set of commands would allow linking a file back to a source (ie. recipe). My usual strategy is to perform searches on the meta data (e.g. grep -R filename ../layers/* ) and searches on the internet of said filenames to find clues of

How to switch linux kernel console after boot process?

夙愿已清 提交于 2019-12-03 11:47:08
问题 On my embedded system I usually use /dev/ttyS0 as a main console. This is achieved by passing kernel parameter console=/dev/ttyS0 and when init takes its part, getty is fired on the same device as specified in inittab by eg. ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 . Is there any possibility to change these settings without restart and switch the console to another terminal like ttyS1 , ttyUSBx or even some pseudo tty? 回答1: It seems that perhaps you don't actually want the console log