LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This 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.

Notices


Reply
  Search this Thread
Old 11-11-2008, 10:59 AM   #1
penguinHugger
LQ Newbie
 
Registered: Aug 2008
Distribution: Ubuntu, EeeOS
Posts: 26

Rep: Reputation: Disabled
Question A question about microcontrollers.


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

Code:
cat compilled code > /dev/sd?
and it get writen to the EEPROM, or do I have to use some software?

Thanks

bye.
 
Old 11-11-2008, 02:39 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
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).
 
Old 11-13-2008, 02:32 PM   #3
penguinHugger
LQ Newbie
 
Registered: Aug 2008
Distribution: Ubuntu, EeeOS
Posts: 26

Original Poster
Rep: Reputation: Disabled
I figured that it wouldn't be that easy. Thanks though.

While we're on the subject of microcontrollers, is there any way to read the code that has already been programmed into the EEPROM?

Thanks for the help

bye.
 
Old 11-13-2008, 07:52 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I think some clarification is in order, here.

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.?

--- rod.

Last edited by theNbomr; 11-13-2008 at 07:55 PM.
 
Old 11-13-2008, 09:44 PM   #5
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Quote:
Originally Posted by penguinHugger View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
programming microcontrollers bob3dan Programming 3 06-05-2007 05:55 PM
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 04:23 AM
Not your regular GRUB question - just a short question for a fried MBR!! ziphem Linux - General 3 01-31-2005 01:51 PM
Linux Porting on 8051/PIC microcontrollers msriram_linux Linux - Software 1 12-02-2004 10:51 AM
login prompt question & kde scheme question JustinCoyan Slackware 2 06-09-2004 02:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration