Have You Got What It Takes To Code Android Apps Using Assembly?

Do you have a rooted Android device and a computer running Linux? If so, you’re already on your way to coding for Android in Assembly. Android devices use ARM processors, and [Vikram] makes the argument that ARM provides the least-complicated Assembly platform, making it a great choice for those new to Assembly programming. We think his eight-part tutorial does a great job of introducing the language and explaining how to get the development tools up and running. You’ll need to know some basic programming concepts, but from what we saw you don’t need any prior experience with ARM or Android.

So why learn Assembly at all? We took a stab at Assembly for AVR a few months ago and really learned a lot about the hardware that we just never needed to know writing in C. It’s a great way to optimise functions that waste too much time because of quirks with higher-level language compilers. That means you don’t need to write your entire application in Assembly. You can simply use it to streamline hairy parts of your code, then include those Assembly files at compile time.

A Study In AVR Power Saving Techniques

amtel_avr

[Scott] found the iCufflinks from Adafruit Industries pretty interesting, but he thought that the stated run time of 24 hours was a bit short. He figured he could improve the product’s power consumption at least a little bit, to improve the overall battery life.

From their schematics, he placed an order for parts and built two identical iCufflink mock-ups side by side – one running their code and one running his. He took baseline current draw measurements, then got busy slimming down the cufflinks’ software. It had been 20 years since he touched assembly, and he has never written it for an AVR, but judging by his work he’s not rusty in the least.

He slowed the ATtiny’s clock down and tweaked a few other settings for a savings of 53μA, but the real improvements came via a fairly simple fix. The original code called for the processor to institute a counting loop to sleep, which he found to be very wasteful. Instead, he chose to put the processor in an idle state, using the chip’s watchdog timer to wake it when it was time to pulse the LED. The power savings from this change alone was a whopping 261μA!

When he was said and done, the changes save about 315μA of current draw, and should allow the cufflinks to run for up to 38 hours without swapping batteries. In [Scott’s] opinion, a nearly 60% improvement in battery life is pretty good for a day’s work, and we’re inclined to agree.

EvalBot: Arrival And Assembly

[Chris Muncy] just received his EvalBot from TI and took some pictures of the assembly process. He was one of the lucky folks that picked up the kit for just $25 using a short-lived coupon code. Seeing the kit makes us wish we had ordered one. There is some assembly required but as you can see, it’s pretty much just mechanical assembly of the wheels and the front bumper arms.

We think the wheel design is quite good. It consists of two small gearhead motors mounted on the rectangular PCB parts that you can see on the right portion of the image above. Those mount to the circular mainboard using metal L brackets. The wheels themselves are three circular pieces of PCB, one with a smaller diameter sandwiched in between its two larger cousins. This creates a channel that is perfect for a neoprene O-ring to give the wheel traction. The main board uses an optical sensors and a hole through all three parts to function as a rotation counter.

It’s a fancy piece of hardware and we can’t wait to see what you can do with it! If you’ve got one, we want to hear about your adventures.

Open Call: Send Us Your Debounce Code

If you’ve ever designed an embedded system with at least one button you’ve had to deal with button debouncing. This is also know as contact bounce, a phenomenon where a button press can be registered as multiple button presses if not handled correctly. One way to take care of this is with a hardware filter built from a resistor-capacitor setup, or by using a couple of NAND gates. We find that [Jack Ganssle] put together the most comprehensive and approachable look at contact bounce which you should read through if you want to learn more.

We’re interested in software solutions for debouncing buttons. This seems to be one of the most common forum questions but it can be hard to find answers in the form of reliable code examples. Do you have debounce code that you depend on in every application? Are you willing to share it with the world? We’d like to gather as many examples as possible and publish them in one-post-to-rule-them-all.

Send your debounce code to: debounce@hackaday.com

Here’s some guidelines to follow:

  • Please only include debounce code. Get rid of other unrelated functions/etc.
  • You should send C code. If you want to also send an assembly code version that’s fine, but it must be supplementary to the C code.
  • Please comment your code. This will help others understand and use it. You may be tempted to explain the code in your email but this info is best placed in the code comments
  • Cite your sources. If you adapted this code from someone else’s please include a note about that in the code comments.

As an example we’ve included one of our favorite sets of debounce code after the break. Please note how it follows the guidelines listed above.

Continue reading “Open Call: Send Us Your Debounce Code”

2-bit Paper Processor Teaches How They Work

Take a few minutes out of your day, grab your scissors, and learn how a simple processor works. [Saito Yutaka] put together an exercise to teach processor operations with paper. After downloading the PDF you can cut out the Address and Data pointer as well as two-bit data tokens for each. The processor has three instruction sets; Increment register by one, Jump if not over flow, and Halt wait for reset.

Once you’ve got your cutouts you can follow along as the program is executed. The INC operation is run, with the JNO used to loop the program. Once the register has reached an overflow the overflow counter halts the program.

One word of warning, we think there’s a typo in one of the captions.  Once the program starts running and gets to address 01(2) the caption still reads 00(2) for both address and data. As long as you compare the values in the picture along the way you should have no problem getting through execution. which has now been fixed.

The Malware Challenge

malware

Our own [Anthony Lineberry] has written up his experience participating in the 2008 Malware Challenge as part of his work for Flexilis. The contest involved taking a piece of provided malware, doing a thorough analysis of its behavior, and reporting the results. This wasn’t just to test the chops of the researchers, but also to demonstrate to network/system administrators how they could get into malware analysis themselves.

[Anthony] gives a good overview of how he created his entry (a more detailed PDF is here). First, he unpacked the malware using Ollydbg. Packers are used to obfuscate the actual malware code so that it’s harder for antivirus to pick it up. After taking a good look at the assembly, he executed the code. He used Wireshark to monitor the network traffic and determine what URL the malware was trying to reach. He changed the hostname to point at an IRC server he controlled. Eventually he would be able to issue botnet control commands directly to the malware. We look forward to seeing what next year’s contest will bring.