Showing posts with label Flashing An ARM With No Soldering. Show all posts
Showing posts with label Flashing An ARM With No Soldering. Show all posts

Sunday, 25 March 2018

Flashing An ARM With No Soldering

Flashing An ARM With No Soldering

[Sami Pietikäinen] was working on an embedded Linux device based on an Atmel SAMA5D3x ARM-A5 processor. Normally, embedded Linux boxes will boot up off of flash memory or an SD card. But if you’re messing around, or just want to sidestep normal operation for any reason, you could conceivably want to bypass the normal boot procedure. Digging around in the chip’s datasheet, there’s a way to enter boot mode by soldering a wire to pull the BMS pin. As [Sami] demonstrates, there’s also a software way in, and it makes use of mmap, a ridiculously powerful Linux function that you should know about.
Embedded Linux devices and the microcontroller in your Arduino or clone aren’t nearly as different as you’d think — you just haven’t read the datasheet for the former. If you’ve gotten deep into microcontrollering, you’re used to the paradigm of controlling the chip’s functionality by twiddling bits that lie in memory-mapped hardware registers. Flip this bit and an LED lights up. Flip that bit and you change the PWM peripheral’s clock speed. That sort of thing.
In Atmel’s SAMA5D3x, there’s a register that controls the initial boot media. Not surprisingly, nobody has written a Linux device driver for setting these bits, so you’ll have to flip them yourself. And the easy way to do that is using mmap which does just what it says — maps a region in memory to some physical peripheral and vice-versa.
Most of the time, you’re better off using the kernel and its drivers instead of directly setting registers with mmap — there’s no mechanisms to prevent multiple access for instance. Fooling around with mmap, with the possible exception of directly memory-mapping files, is best left for debugging device drivers or crashing your system. Unless you need to control the boot mode of a chip by setting some bits directly, that is.
[Sami]’s demonstration isn’t anything super secret, and some of you will cry “not a hack!1!!” because he’s just using information straight out of the manufacturer’s datasheet, but we found his writeup to be a nice tutorial and reminder of just how powerful memory-mapping can be in bridging the gap between what you might think of as a computer and a microcontroller. If you want to mess around with an embedded Linux system, and you can get root, mmap may be just the ticket. Or you may just be interested in blinking LEDs very quickly. Pick your poison.

Why I Ditched My Family’s Tried-and-True Accountant For DIY Taxes

Why I Ditched My Family’s Tried-and-True Accountant For DIY Taxes  © wutwhanfoto / iStock.com Man using calculator and calculate bills in...