问题
I just started to learn micro-controller programming and I seem to have a lot of trouble getting started, particularly the simulation part.
This is an application I need to program: I need to store a few wave files in a flash memory chip, and use a Cortex-M0 to read in the music from the flash memory, and play them in combination, or run some basic signal processing on them.
I am looking for an IDE that supports the end-to-end simulation on this. I looked at CoIDE (because if I google free cortex IDE that's the first coming up), and before settling at Cortex I also looked at MPLAB, but I don't see any of those support flash memory chip simulation. I seem to be able to simulate a chip properly, but I dont see a way to build up a virtual flash memory chip.
Am I missing anything? Thanks a lot.
回答1:
First of all - MPLAB is an IDE for Microchip's products, and Microchip does not have any ARM chips, so this IDE won't help you at all.
As for CooCox - this IDE is basically Eclipse + GCC toolchain, and from what I know most toolchains available on the network don't enable simulator, and even if they did, this is just an instruction simulator (and probably not for your architecture, but I'm not sure about that), so you may as well write your software on PC, test it there and then move that to real hardware - the algorithms will really work the same (if you use portable code, so using "int" on a 64-bit desktop is not a good idea, better to use types from for everything).
Only big commercial IDE and toolchains like IAR or Keil may have a simulator for your chip (but this may also be problematic, as these are pretty new), you just need a couple thousand euros and that's it.
My advice - just forget about simulator when doing embedded work.
The reason for such situation is probably simple - it's impossible to accurately simulate a real hardware. To achieve sth like that you'd first have to have a complete IP core of the device, along with exact VHDL (or anything like that) description of all the connections and peripherals inside the chip. I just don't see all vendors giving such info to any company willing to create an IDE (; Then you'd need a real-time simulator for VHDL (or anything else), capable of simulating really big chips with a lot of peripherals. This is probably possible, so let's move to another point. In real world the chip does not operate in a vacuum, it is connected to real hardware with real phenomenons and real signals. You just cannot accurately simulate that. A simple push-button can behave in millions of different ways depending on millions of conditions (age, force, temperature, humidity, length of traces, size, quality of PCB, quality of assembly, ...).
Your project is quite a good example of the problems listed above. You may find a simulator of your ARM Cortex-M0 chip, but you won't be able to simulate the external flash chip connected to your microcontroller. You may as well stop looking, as I assure you that you won't find anything like that. BTW - your chip does not have external memory bus, so you'll have to operate the memory completely in software (the contents of external memory will NOT be mapped to some address range of your chip).
So as a final note - lack of simulator is not a problem - you have a debugger (which is capable of some things you could use simulator for), you have multiple debug-like-methods (blinking LEDs, printfs(), ...), you have h/w tools to check the system (multimeters, oscilloscopes, logic analyzers, ...), so it's not that bad (;
One more thing about CooCox. For me the idea is a bit fishy - it's free, it's based on free components, so why it's not open-source (some places claim it is, so where's the source)? There were other "free" environments like that in the past and it turned out that "free" meant "let's use free beta-testers for a while", and when the project reached some level of maturity it became commercial or severely limited in the free version... Atollic TrueStudio comes to mind as a great example of this strategy (and people LOVED it when it was free - everyone recommended it - "don't bother with GCC, use atollic, it's free and has no limitations"). I don't know how will future of CooCox look like, but this software is sometimes a bit strange, sometimes a big buggy and does not support all chips, so first check whether it "likes" your chip of choice. Oh - and it's done by people from China.
Embedded work may seem very like writing code for PC, but actually is a big shift in a way you think...
来源:https://stackoverflow.com/questions/14928198/microcontroller-and-flash-memory-chip-programming-development-and-simulation