embedded

convert ASM to C (not reverse engineer)

旧城冷巷雨未停 提交于 2019-11-27 13:11:35
I googled and I see a suprising amount of flippant responses basically laughing at the asker for asking such a question. Microchip provides some source code for free (I don't want to post it here in case that's a no-no. Basically, google AN937, click the first link and there's a link for "source code" and its a zipped file). Its in ASM and when I look at it I start to go cross-eyed. I'd like to convert it to something resembling a c type language so that I can follow along. Because lines such as: GLOBAL _24_bit_sub movf BARGB2,w subwf AARGB2,f are probably very simple but they mean nothing to

Multiple assignment in one line

落爺英雄遲暮 提交于 2019-11-27 13:09:45
I just come across the statement in embedded c (dsPIC33) sample1 = sample2 = 0; Would this mean sample1 = 0; sample2 = 0; Why do they type it this way? Is this good or bad coding? Remember that assignment is done right to left, and that they are normal expressions. So from the compilers perspective the line sample1 = sample2 = 0; is the same as sample1 = (sample2 = 0); which is the same as sample2 = 0; sample1 = sample2; That is, sample2 is assigned zero, then sample1 is assigned the value of sample2 . In practice the same as assigning both to zero as you guessed. Formally, for two variables t

D-Bus tutorial in C to communicate with wpa_supplicant

二次信任 提交于 2019-11-27 13:00:18
问题 I'm trying to write some code to communicate with wpa_supplicant using DBUS. As I'm working in an embedded system (ARM), I'd like to avoid the use of Python or the GLib. I'm wondering if I'm stupid because I really have the feeling that there is no nice and clear documentation about D-Bus. Even with the official one, I either find the documentation too high level, or the examples shown are using Glib! Documentation I've looked at: http://www.freedesktop.org/wiki/Software/dbus I found a nice

How can I visualise the memory (SRAM) usage of an AVR program?

折月煮酒 提交于 2019-11-27 12:58:08
问题 I have encountered a problem in a C program running on an AVR microcontroller (ATMega328P). I believe it is due to a stack/heap collision but I'd like to be able to confirm this. Is there any way I can visualise SRAM usage by the stack and the heap? Note: the program is compiled with avr-gcc and uses avr-libc. Update: The actual problem I am having is that the malloc implementation is failing (returning NULL ). All malloc ing happens on startup and all free ing happens at the end of the

Cycle counter on ARM Cortex M4 (or M3)?

大城市里の小女人 提交于 2019-11-27 12:54:44
I'm trying to profile a C function (which is called from an interrupt, but I can extract it and profile it elsewhere) on a Cortex M4. What are the possibilities to count the number of cycles typically used in this function ? Function shall run in ~4000 cycles top, so RTC isn't an option I guess, and manually counting cycles from disassembly can be painful - and only useful if averaged because I'd like to profile on a typical stream with typical flash / memory usage pattern. I have heard about cycle counter registers and MRC instructions, but they seem to be available for A8/11. I haven't seen

using serial port RS-232 in android?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 12:10:11
I want to send signals via serial port using the JavaComm API classes on an Android device, and here is how I imagine it: 1- the Android device would be: Archos 3.2 which has android 2.2 and USB host mode. 2- include RxTx lib package with my Android app. and include RxTx native code using Android NDK. 3- a short cable which is usb-->serial. Could you explain to me where I might face problems? I just ported the JavaCOMM ( GNU RXTX ) library to the Android. Here is the link http://v-lad.org/projects/gnu.io.android/ You still might need to rebuild your kernel and maybe recompile the shared

How to determine maximum stack usage in embedded system with gcc?

烂漫一生 提交于 2019-11-27 10:56:39
I'm writing the startup code for an embedded system -- the code that loads the initial stack pointer before jumping to the main() function -- and I need to tell it how many bytes of stack my application will use (or some larger, conservative estimate). I've been told the gcc compiler now has a -fstack-usage option and -fcallgraph-info option that can somehow be used to statically calculates the exact "Maximum Stack Usage" for me. ( "Compile-time stack requirements analysis with GCC" by Botcazou, Comar, and Hainque ). Nigel Jones says that recursion is a really bad idea in embedded systems (

How does Linux determine the order of module init calls?

蓝咒 提交于 2019-11-27 10:09:16
问题 I have a device with SPI flash storage I'd like to use an UBIFS filesystem on that flash device as my rootfs. The problem I'm facing is that the UBI module initializes before the SPI module initializes. Because of this, when UBI loads, it cannot attach to the UBI device that I've told it to (via the kernel command line), so there is no rootfs. The console output below illustrates this. I've been diving into the source enough to see that init/main.c has a do_initcalls() function that simply

What are the available interactive languages that run in tiny memory? [closed]

僤鯓⒐⒋嵵緔 提交于 2019-11-27 10:01:06
I am looking for general purpose programming languages that have an interactive (live coding) prompt work in 32 KB of RAM by itself or 8 KB when the compiler is hosted on a separate machine run on a microcontroller with as little as 8-32 KB RAM total (without an MMU). Below is my list so far, what am I missing? Python : The PyMite VM needs 64K flash, 8K RAM. Targets LPC, SAM7 and ATmegas with 8K or more. Hosted. Lua : The eLua FAQ recommends 256K flash, 64K RAM. FORTH : amforth needs 8K flash, 150 bytes RAM, 30 bytes EEPROM on an ATmega. Scheme : armpit Scheme The smallest target is the

AOSP repo sync takes too long

我与影子孤独终老i 提交于 2019-11-27 09:53:26
问题 I'm trying to learn Embedded Android from the book with the same name. And the author suggested working with AOSP gingerbread branch. So I followed to download the source: $ repo init -u https://android.googlesource.com/platform/manifest.git -b gingerbread $ repo sync But it's taking too long. Also from the output, it seems to me like it's also downloading source code from other branches (I see android-5.....) which is not what I want. I'm wondering if that's the reason why it takes so long.