Hot answers tagged

133

You kids, get off my lawn! 384 bytes is plenty of space to create something quite complex in assembler. If you dig back through history to when computers were the size of a room, you'll find some truly amazing feats of artistry executed in <1k. For instance, read the classic Story of Mel - A Real Programmer. Admittedly, those guys had 4096 words of ...


80

Intel's Haswell (or at least those products that incorporate the Iris Pro 5200 GPU) and IBM's POWER7 and POWER8 all include embedded DRAM, "eDRAM". One important issue that has led eDRAM not to be common until recently is that the DRAM fabrication process is not inherently compatible with logic processes, so that extra steps must be included (which increase ...


59

Microcontrollers are sufficiently cheap that they are often used to do really simple things that in years past would more likely have been done with discrete logic. Really simple things. For example, one might want a device to turn on an output for one second every five seconds, more precisely than a 555 timer would be able to do. movwf OSCCON mainLp: ...


44

There are several reasons for this. First of all, memory takes up a lot of silicon area. This means that increasing the amount of RAM directly increases the silicon area of the chip and hence the cost. Larger silicon area has a 'double whammy' effect on price: larger chips mean less chips per wafer, especially around the edge, and larger chips means each ...


39

.text The .text segment contains the actual code, and is programmed into Flash memory for microcontrollers. There may be more than one text segment when there are multiple, non-contiguous blocks of Flash memory; e.g. a start vector and interrupt vectors located at the top of memory, and code starting at 0; or separate sections for a bootstrap and main ...


37

Unless you have an initial state programmed, it will be more or less random. Although this may vary with different SRAM implementations. You also say "blank". Some might think that random is "blanker" than all 0's. SRAM memory stores memory on back to back inverters. This forms a bi-stable system (two very stable states with metastability dividing ...


29

The original electronic nonvolatile memory is based on ferrite cores. While it's relatively easy to magnetize such a core in one direction or the other to store a one or a zero, it takes some fairly sophisticated circuitry to read it back reliably. Modern nonvolatile chips rely on charge storage, but in order to make this work, you need to be able to create ...


27

It is very simple. Number of pins and cost of packaging. EEPROM devices are primarily used to store parametric data or characterization constants for a device. The typical scenario is to write very seldom and read typically once each time the host device boots up. For this type of application the relatively slow writing times of EEPROM are of little ...


26

"ONLY" 384 bytes? Way back in the day, I had the job of writing an entire operating system (by myself) for a specialized computer that served the ship, pipeline, and refinery management industry. The company's first such product was 6800 based and was being upgraded to 6809, and they wanted a new OS to go along with the 6809 so they could eliminate the ...


25

Using dynamic memory allocation on a 16 bit MCU with 4kb RAM is very poor engineering. Not so much because of the usual problems with memory leaks. Not so much because of heap memory fragmentation. Not even because of the rather steep execution time overhead needed for the allocation routines. But because it is completely pointless and makes no sense. You ...


25

In both cases (EEPROM/flash and DRAM) a small (femtofarads) capacitor is used. The difference is the way the capacitor is connected. In the case of DRAM it is connected to the source or drain of a MOSFET. There is a tiny bit of leakage through the transistor channel and the charge will leak off in a relatively short period of time (seconds or minutes at ...


25

Memory addresses are binary numbers. The range of an N-bit (unsigned) binary number is 0 to 2N-1, a total of 2N different values. Since addresses are passed to memory chips as binary numbers, it makes sense to build them in capacities of powers of 2. That way, none of the address space is wasted, and it's easy to combine multiple chips/modules to build ...


24

No, they're not the same type of RAM, even though they're on the same chip that uses the same manufacturing process. Of all the caches, the L1 cache needs to have the fastest possible access time (lowest latency), versus how much capacity it needs to have in order to provide an adequate "hit" rate. Therefore, it is built using larger transistors and wider ...


22

Nowadays, Flash memory is used to hold program code, and EEPROM (Electrically Erasable Read-only Memory) is used to hold persistent data. Back some 30 years ago, before Flash came along, EEPROMs were used to hold program code. Actually ROM (Read-Only Memory) came first, then PROM (Programmable ROM, once only), EPROM (PROM Erasable with UV light), EEPROM, ...


22

You cannot extend the program memory (flash). TI produces the same chip with double the flash and RAM, but nothing else changed: TM4C1230D5PMI. If you cannot use a chip with larger flash, you will have to reduce your code size: Disable debugging, such as the expensive printf function. A printf that supports floating point output will typically set you ...


22

Normal embedded system: Segment Memory Contents .data RAM Explicitly initialized variables with static storage duration .bss RAM Zero-initialized variables with static storage duration .stack RAM Local variables and function call parameters .heap RAM Dynamically allocated variables (usually not used in ...


21

You can use this for very small applications (e.g. delayed PSU start, 555 timer replacement, triac-based control, LED blinking etc...) with smaller footprint than you'd need with logic gates or a 555 timer.


21

I can't speak about FRAM (ferroelectric memory), but any technology that uses floating gates to store charge — any form of EPROM, including EEPROM and Flash — relies on electrons "tunneling" through a very thin insulating silicon oxide barrier to change the amount of charge on the gate. The problem is that the oxide barrier is not perfect —...


21

Three non-volatile memory types match your needs, in order of available size: Wear leveled EEPROM/FLASH. Battery backup SRAM. FRAM. In terms of cost, FRAM is best. All you need is inside the chip, including backup capacitors to complete writing. However available sizes are low. Battery backup SRAM is large and costly in materials. Wear leveled EEPROM ...


21

Here is what I did on a product that's still in mass production. Keep all the parameters and counters in RAM Hook up an interrupt line to a power supply voltage threshold detector When the interrupt triggers, shut off everything that consumes power (most peripherals, LEDs, etc) and back up all the RAM to flash. Turns out there was about 10-20ms of time ...


20

Personally for hobby projects I tend to use the most powerful microcontroller in the family with the right footprint. I then develop the PCB, write some code and produce a prototype. This has the advantage that I know the small number of microcontrollers fairly well, so I can rapidly prototype without having to read a whole datasheet. I also have breakout ...


20

Whatever you declare as a variable in your code will be in the RAM of the PIC, and thus will disappear when you power it off. However, the PIC18F2580 has 256 bytes of EEPROM memory, which is non-volatile. You can store your phone numbers there each time they are modified, and load them at boot to your variables. To read and write a byte to a given address ...


19

The appropriate standard solution is probably QSPI (also called QPI, or also SQI). It is somewhat an extension of the SPI interface, but uses four (quad, hence the Q in the acronym) data bits (IO0/IO1/IO2/IO3) instead of a single signal for each direction (MISO/MOSI). So the chips are very small (typically SO-8), and the interface is very efficient: you ...


19

It literally stores lines of machine code from program memory (aka the entire instruction you line in your original post. The fact you even discuss "storing all possible op codes in cache" points to a deeper misunderstanding. Talking about storing all possible op codes in cache (or any memory for that matter) has no meaning. All the possible opcodes that ...


17

I designed a humidity sensor for plants that tracks the amount of water the plant has and blinks an LED if the plant needs water. You can make the sensor learn the type of plant and thus change its settings while running. It detects low voltage on the battery. I ran out of flash and ram but was able to write everything in C code to make this product work ...


17

The main reasons larger memory (GB's of DRAM) isn't included on the CPU die itself is primarily about cost. CPU die space is significantly more expensive because of the manufacturing process required to make the very small features. It may also not be possible to manufacture the two on the same die, though I don't know enough about the details to give any ...


17

You misunderstand what the heap is. The heap is the area where malloc gives you blocks of RAM dynamically at run-time. Your globally scoped, statically allocated variables & arrays are not 'on the heap'. If you're not using malloc or any of its variants in your program, you can quite safely set the heap size to 0.


16

One thing that I haven't seen mentioned: The microcontroller you mentioned is only $0.34 each in quantities of 100. So for cheap, mass-produced products, it can make sense to go to the extra coding trouble imposed by such a limited unit. The same might apply to size or power consumption.


16

You can't really make assumptions about the program counter (PC) width from the memory address width. There have been many many different memory architectures historically, and new ones will undoubtedly be dreamed up. At a very basic level for the simplest of machine, the PC contains the memory address during instruction fetches, so is the same width as ...


15

Memory probably takes up the most silicon space, and RAM being very fast to use is volatile - and uses power constantly to keep its state. Unless you need lots of RAM, it's not useful for many other applications. If an embedded system designer needs more RAM, they merely get an external RAM chip and use peripheral memory interfaces that microcontrollers ...


Only top voted, non community-wiki answers of a minimum length are eligible