embedded

How to find a memory leak in C++

梦想的初衷 提交于 2019-12-03 00:25:51
What would be a good way to detect a C++ memory leak in an embedded environment? I tried overloading the new operator to log every data allocation, but I must have done something wrong, that approach isn't working. Has anyone else run into a similar situation? This is the code for the new and delete operator overloading. EDIT: Full disclosure: I am looking for a memory leak in my program and I am using this code that someone else wrote to overload the new and delete operator. Part of my problem is the fact that I don't fully understand what it does. I know that the goal is to log the address

sources of “uniqueness”/entropy on embedded systems

怎甘沉沦 提交于 2019-12-02 23:07:25
I have an embedded system. What I would like for it to do when it powers up or otherwise resets, is to generate a unique ID, so that on different restarts a different unique ID is generated with high probability. It does not have access to a real-time clock, but it does have access to an ADC and a UART. I am wondering if there is a decent way to gather entropy from these sources to generate a unique ID. I am vaguely familiar with Yarrow . Is there a good way to use this? Unfortunately I do not have any noise sources of predictable characteristics; the ADC is connected to a number of relatively

How can I broadcast data to multiple SPI slaves and how it works?

若如初见. 提交于 2019-12-02 22:55:56
问题 I know basic SPI protocol and its master to slave operations. I want to know that is it possible to broadcast data on multiple slave? If it is possible then how it works. I've heard that after writing to any SPI slave you have to read from slave even if you are not going to use read data. How is this possible in case broadcast if broadcast is possible? 回答1: No, it's not possible. Since SPI is 4- wire interface. The SS line is used for slave selection.One SPI master can have multiple slaves

Unravelling Assembly Language Spaghetti Code

元气小坏坏 提交于 2019-12-02 22:41:35
I've inherited a 10K-line program written in 8051 assembly language that requires some changes. Unfortunately it's written in the finest traditions of spaghetti code. The program--written as a single file--is a maze of CALL and LJMP statements (about 1200 total), with subroutines having multiple entry and/or exit points, if they can be identified as subroutines at all. All variables are global. There are comments; some are correct. There are no existing tests, and no budget for refactoring. A little background on the application: The code controls a communications hub in a vending application

Difference between ISR and Function Call?

守給你的承諾、 提交于 2019-12-02 21:10:47
I want to understand difference between ISR (Interrupt Service Routine) and Function call. I feel both the function call and ISR are the same from the hardware perspective. Please Correct me if I am wrong. All I could found about ISR and Function call is as follows: ISR: Asynchronous event that can occur any time during the execution of the program Saves the PC, Flags and registers on the stack and disables all the interrupts and loads the address of the ISR ISR cannot have arguments that can be passed to it Cannot return values Enables the interrupts Generally small as they are taking the

ARM TrustZone development

雨燕双飞 提交于 2019-12-02 21:04:46
I am wondering if anyone have any information on development boards where you can utilize ARM TrustZone? I have the BeagleBoard XM which uses TI's OMAP3530 with Cortex-A8 processor that supports trust zone, however TI confirmed that they have disabled the function on the board as it is a general purpose device. Further research got me to the panda board which uses OMAP4430 but there is no response from TI and very little information on the internet. How do you learn how to use trust zone? Best Regards Mr Gigu As far as I know, all the OMAP processors you can get off-the-shelf are GP devices, i

What is Test-and-Set used for?

好久不见. 提交于 2019-12-02 19:36:11
After reading the Test-and-Set Wikipedia entry , I am still left with the question "What would a Test-and-Set be used for?" I realize that you can use it to implement Mutex (as described in wikipedia), but what other uses does it have? moonshadow You use it any time you want to write data to memory after doing some work and make sure another thread hasn't overwritten the destination since you started. A lot of lock/mutex-free algorithms take this form. A good example is "increment." Say two threads execute a = a + 1 . Say a starts with the value 100 . If both threads are running at the same

What's an efficient implementation of Conway's Game of Life for low memory uses?

三世轮回 提交于 2019-12-02 19:29:25
I'm looking for a fast and memory efficient approach for implementing Conway's Game of Life. Constraints: a 96x128 board, approximately 2kB RAM available and 52MHz processor (see the tech specs here: http://www.getinpulse.com/features ). My current naive solution that represents each cell as a single bit in a matrix (96*128/8=1,536 bytes) works but is too slow. What tricks can be used to improve performance? Storing the coordinates of live cells (for example in this implementation http://dotat.at/prog/life/life.html ) would use too much memory. Looks like a fun piece of hardware. Storing 1 bit

Emulating UART over USB

百般思念 提交于 2019-12-02 18:37:31
Does anybody know if it's possible to emulate UART (simple serial transmit and receive) over USB? How would this be accomplished? I found this link on the Microchip website, but it's not very forthcoming. http://www.microchip.com/forums/m522571-print.aspx Any ideas? Thanks. Habi Basically you have two options to emulate UART over USB: Use an existing product. The company FTDI provides well known and solid UART-USB bridge chips, e.g. FT230X. Pro: You don't need any detailed knowledge about USB. Cons: Expensive if used in mass production. Additional hardware, needs additional power. Implement

Seeing how Instructions get Translated (Computer Architecture)

帅比萌擦擦* 提交于 2019-12-02 18:28:34
Little bit of a confusing question. But Im really looking for learning some low level programming. Thing is, Dev boards like Arduino/Etc. really hide alot of whats going on. I have spent some time learning about Computer Architecture, Logic/Gates/Sequential Logic/etc.. (I went even as far as to learn the Physics of Semiconductors and Electronics related to it all, just to know what exactly is going on, as well as how Gates are made using CMOS Transistors and such). But thats about where it ends....and I want to be able to understand how an Instruction (Like Hex/or Assembly/etc.. code) is