3
\$\begingroup\$

I'm familiar with using microcontrollers, both with frameworks like Arduino and natively (PIC / AVR). I'm also familiar with the general architecture of embedded systems, in so much as I know you have a processor with discrete RAM and ROM/flash connected via various buses. However, I've never really built a project from the ground up using a microprocessor.

What should I know before moving on to microprocessor-based projects? For example, on a microcontroller, I'm used to just sending some code through my compiler and getting a binary that can be uploaded via ISP or similar - how does this work with a processor with discrete flash? And what about clock sources - do processors normally come with an internal clock like MCUs do? I'm sure there are plenty of "unknown unknowns" too - where should I look to get started?

I'm primarily interested in ARM and x86 platforms, but general advice would also be useful.

\$\endgroup\$

closed as primarily opinion-based by markt, Daniel Grillo, nidhin, Scott Seidman, Matt Young Mar 12 '15 at 13:58

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ The only thing that really changes is the upload mechanism. And that mechanism can take any of dozens of forms. \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 10 '15 at 19:21
  • 1
    \$\begingroup\$ @IgnacioVazquez-Abrams I don't see how that can be the case - surely there are intricacies to how RAM/ROM is accessed which don't exist in MCUs? \$\endgroup\$ – Polynomial Mar 10 '15 at 19:26
  • \$\begingroup\$ Only with how it's connected. Otherwise it still just uses the address and data buses as normal. \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 10 '15 at 19:28
  • 1
    \$\begingroup\$ With modern SoCs the distinction between the two is pretty marginal and largely a matter of pedantry. More a question of what kinds of things you have in the system e.g. external DRAM, memory controllers etc. \$\endgroup\$ – pjc50 Mar 10 '15 at 19:39
  • \$\begingroup\$ The I/O bus is more "disconnected" from the core in modern microprocessors than in small microcontrollers. Look at a metric such as how fast you can toggle an I/O pin via software divided by the MIPS. It could easily be more than an order of magnitude more higher on a small microcontroller. \$\endgroup\$ – Spehro Pefhany Mar 10 '15 at 21:00
2
\$\begingroup\$

The main difference in these systems is that they generally do not run the majority of directly out of flash -- instead, there will be a small program in flash that acts as a bootloader, and the program will then be copied from some medium such as a SD card or SSD or hard drive into RAM, where it is then run from. If there is a need to update the bootloader, there will be some means, either through the microprocessor or external, to update reprogram it.

So when you update your program, it will be downloaded to your system and then written to the SD card or SSD or hard drive, whatever you have.

When its running, there is really no difference between a microcontroller and a microprocessor. It's just that in the latter case, there is a lot more RAM (perhaps several hundred MB) than you would find in a microcontroller. The CPU doesn't care whether it is running out of RAM or flash. One thing you do have to look out for: an errant program can wipe itself out in RAM, whereas this can't happen in flash.

Microprocessors will almost always have an external crystal as a clock source. The processor may use a PLL (phase locked loop) to multiply the crystal frequency up to a much higher value (several hundred MHz or even a GHz). This will be part of the initialization code.

Accessing peripherals is essentially the same as with a microcontroller; they're just external to the chip instead of inside it, so access is not as fast. (The only "peripherals" typically on an x86 chip are timers, DMA, and interrupt controller.) The processor communicates with the peripherals devices through I/O ports.

\$\endgroup\$
  • 1
    \$\begingroup\$ XIP is definitely awesome though. \$\endgroup\$ – Ignacio Vazquez-Abrams Mar 10 '15 at 19:31
  • \$\begingroup\$ @IgnacioVazquez-Abrams Thanks, wasn't aware of that. \$\endgroup\$ – tcrosley Mar 10 '15 at 19:40
-1
\$\begingroup\$

In my opinion, one of the best methods of discriminating between an MPU and an MCU is whether the CPU includes a memory management unit (MMU) - that is, a hardware mechanism for mapping non-contiguous blocks of memory into a virtual contiguous space on the fly, with the mapping dependent on which process is executing.

This allows individual processes to use any memory that they can "see" and protects any memory that they can't "see" from accidental accesses.

A CPU with an MMU is an MPU; a CPU without an MMU is an MCU.

\$\endgroup\$
  • \$\begingroup\$ Sorry, but just plain wrong. The earlier microprocessors (8080, 6800, 6502, original 8086, Z80, even the 68000) did not have an MMU -- yet they were definitively microprocessors, not microcontrollers. They did not have any on-board memory or peripherals. The 68030 was one of the first microprocessors to have an integrated MMU. The 8051 was one of the first microcontrollers. A better distinction between microprocessors and microcontrollers is whether they have an external address bus -- true in most cases. See this answer for more. \$\endgroup\$ – tcrosley Mar 11 '15 at 7:34
  • \$\begingroup\$ @tcrosley No, I'm not wrong; if I was wrong I'd know. I'm actually referencing ARM's opinion; I think I'm on fairly safe ground in accepting that they know what they're talking about. Some additional criteria may apply, e.g. external memory, but having an MMU makes good sense because of its relevance to multi-tasking (as opposed to multi-threading). \$\endgroup\$ – markt Mar 11 '15 at 10:35
  • \$\begingroup\$ ARM's a special case because they make some microcontrollers with external address busses, so they are a combination of a microprocessor and microcontroller. What they want to call them is their business. It's not the mainstreeam view. See this and this and this. No mention of MMU as a criteria. \$\endgroup\$ – tcrosley Mar 11 '15 at 11:00
  • \$\begingroup\$ @trcosley yeah... Those aren't much more than sales guides, I think I'll stick with ARM's viewpoint. I'm not saying that other factors aren't relevant, but the presence of an MMU makes or breaks it as far as I'm concerned. \$\endgroup\$ – markt Mar 11 '15 at 11:04
  • \$\begingroup\$ So you're saying the 8080, 6800, 6502, 8086, Z80, and 68000 were not microprocessors? What were they? Certainly not microcontrollers, they had no memory or peripherals on chip. They made the distinction between microcontrollers (8048, 8051) and microprocessors even then. \$\endgroup\$ – tcrosley Mar 11 '15 at 11:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.