Linux - Embedded & Single-board computerThis forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have recently decided to learn assembly language, and have also found that that is how microcontrollers are programmed. (I never knew.) I learned that you compile the assembly language and then the BIOS/controller reads the compiled assembly language starting at the first sector on the ROM (HDD, EEPROM, etc). After I connect the microcontroller to my comp via the "programmer", can I just write the compiled assembly language to the /dev device
cat compilled code > /dev/sd?
and it get writen to the EEPROM, or do I have to use some software?
It depends. You need to read the documentation of the microcontroller. Usually you need to use special software, for instance for JTAG programming. It also depends on the device your processor can boot from (serial, USB, flash etc).
All CPUs boot by fetching an instruction at a 'hardwired' address as they come out of a reset state. This address is generally a permanent, standard, documented address that is specific to the CPU family. Normally, there will be some kind of non-volatile memory (ROM, EPROM, EEPROM, etc.) mapped at this address, and this code is the first to execute as the CPU boots. Often, this code is what we call a BIOS, although strictly speaking, a BIOS is a collection of routines that provide OS-like services to access peripheral components that are part of the circuit that hosts the CPU, and may be mapped anywhere in the CPU address space. A microcontroller normally sees program memory as just a contiguous space, not divided into sectors such as the way a magnetic media is commonly addressed.
For a microcontroller (where this usage generally implies a smallish, probably 8-bit CPU, frequently with some on-chip periperals), it is not uncommon to place the entire application in this one ROM. The code that is placed in the ROM is usually put there by extracting the chip and using some type of special tool to write the code to the chip. The exact nature of such a device depends on the type of chip. It may be possible, depending on the design of the system, to program the ROM without physically extracting the part (someone else said JTAG, as an example).
It has been a while since I've done his type of work, but when I did, most ROM burners interfaced through either serial RS-232 ports, or through the ubiquitous PC parallel port. These days, I suppose they probably use USB or ethernet. JTAG interfaces were very commonly driven through parallel ports. Whatever the case, the device would be operated through a custom software package. Hard to say whether (m)any manufacturers supply software that runs on Linux. Most times, the burner software can also read an already programmed chip, to provide you with a disk copy of the contents. The devices can also do other functions, such as fill with specified bytes or patterns, erase (if the device is electrically erasable), produce various signature checksums, etc.
Often, microcontrollers contain on-chip program memory that is not readable through external means. This allows manufacturers to supply products with intellectual property that cannot be copied. It can be programmed (written), maybe even erased, but cannot be read, except by the CPU fetching opcodes and operand data from code space.
Even if a 'processor can boot from (serial, USB, flash, disk', before it can really do so, it must be able to configure such peripherals, and this is done through the lowest level boot code.
Many developers either write (for their target hardware) or buy or download a boot ROM containing a 'monitor' program. This kind of code is often used interactively much like a debugger to read and write to memory or IO address space, and may also be used to load user-downloadable code over some interface such as a serial port. The code might then be executed, as part of a software test & development cycle. This method might be favoured by hobbyists, since it is quite low cost.
So, why don't you tell us what kind of CPU you are planning to play with and what tool set you will use, etc.?
While we're on the subject of microcontrollers, is there any way to read the code that has already been programmed into the EEPROM?
Yes, but how easy that is depends on a few things:
1. Is the EEPROM on the same chip as the CPU? If it is and a "protection" bit is set, the only way to read out the data is to chemically etch away the casing, identify the appropriate circuitry under a microscope, and do some appropriate damage to that circuitry. The guys in the semiconductor test and development labs can do that all in a few hours, but most people can't.
2. If the EEPROM is a separate chip then there is a very good chance that all you have to do is connect it to some appropriate circuitry, step through the various addresses and record the data stored.