Reserving flash location for EEPROM emulation STM32F4 - microcontroller

I want to emulate EEPROM in sectors 2 and 3 to keep erase time low (small 16kb sectors).
My question is how to go about reserving this flash space to prevent compiler from placing program code in these sectors?
Can anyone point me to info on this I haven't found anything that makes sense so far?
Thanks

From Application Note AN3969, the best approach would be, as you have said is to use Sectors 0-3 since they are only 16kB.
My question is how to go about reserving this flash space to prevent compiler from placing program code in these sectors?
In your linker file (*.ld) declare the start of your Flash to be at the beginning of Sector 4 so that the Linker places your code beginning at that address eg.

Related

Is an user space on a MCU possible?

I'm currently researching the possibility of making some kind of user space on an MCU. User space is probably not the right therm here.
What we want is space on the memory that a user can freely use to add code and execute it. The rest of the memory will be used for the bootloader and some kind of library/package that the user space can "use".
Normally you would just compile the whole code, so including the
(precompiled) library and user code and then flash it to the MCU. But we are afraid that the library can be reverse engineered. So we want some way to "fix" the library on the MCU to at least make it harder to reverse engineer.
When I try to research this subject I only get results about Operating Systems, so probally user space is the wrong therm. I'm struggling to find more information about this. Is this possible, does it even make sence to do something like this?
The MCU in question has a Core-M4

How much a Flash memory of an MPC can be flashed/erased (Flash Endurance , life cycles)

I began programming the MCP5748G, the problem is that i'm working on an existing application and I'm adding a module that depends on other modules.
The module i'm developing is working well but when combined with the others modules both have to be modified. So for this purpose i'm doing a lot of debugging and re-programming of the flash memory.
Sometimes i could go up to 100 flash/erase cycles per day.
The developpement should take a while let's say 2 month and i don't know if the MCU can resist this period.
That's why i'm wondering for
What is the maximum of flash cycles for this MCU ? : the documentation is too long and i couldn't find the information on it.
And also i'm flashing and erasing just a specified blocks of the flash memory.The total flash is 5mb but i'm using 2mb only. I flash per blocks of 256kb , i want to know if flashing just a block affects the other blocks too and also if the performance of the flash memory is degrading after each erase/flash operation.
I know that every MCU support different flash cycles but if you have some infos on how to find the answer on the doc it would be very helpfull too.
Thanks

Implement IP camera

We have a device that has an analog camera. We have a card that samples it and digitizes it. This is all done in directx. At this point in time, replacing hardware is not an option, but we need to code such that we can see this video feed real-time regardless of any hardware or underlying operating system changes occur in the future.
Along this line, we've chosen Qt to implement a GUI to view this camera feed. However, if we move to a linux or other embedded platform in the future and change other hardware (including the physical device where the camera/video sampler lives), we will need to change the camera display software as well, and that's going to be a pain because we need to integrate it into our GUI.
What i proposed was migrating to a more abstract model where data is sent over a socket to the GUI and the video is displayed live after being parsed from the socket stream.
First, is this a good idea or a bad idea?
Secondly, how would you implement such a thing? How do the video samplers usually give usable output? How can I push this output over a socket? Once I am on the receiving end parsing the output, how do I know what to do with the output (as in how to get the output to render)? The only thing I can think of would be to write each sample to a file and then to display the contents of the file every time a new sample arrives. This seems like an inefficient solution to me, if it would work at all.
How do you recommend I handle this? Are there any cross-platform libraries available for such a thing?
Thank you.
edit: i am willing to accept suggestions of something different rather than what is listed above.
Have you looked at QVision? It is a Qt based framework for managing video and video processing. You don't need the processing, but I think it will do what you want.
Anything that duplicates the video stream is going to cost you in performance, especially in an embedded space. In most situations for video, I think you're better off trying to use local hardware acceleration to blast the video directly to the screen. With some proper encapsulation, you should be able to use Qt for the GUI surrounding the video, and have a class that is platform specific that you use to control the actual video drawing to the screen (where to draw, and how big, etc.).
Edit:
You may also want to look at the Phonon library. I haven't looked at it much, but it appears to support showing video that may be acquired from a range of different sources.

Programming microcontroller to store images and displaying them as a dia-show with an dvi/hdmi output in several resolutions?

I would like to solder a microcontroller, control buttons and an DVI/HDMI output and program this in a way, that I can store images on it and let them display as a dia-show via the outputs.
It doesn't have to have a lot of storage capacity, 128Mb would be enough.
but I don't know how to start, because I haven't done anything like this before.
My aim is to present some important images to friends by just taking this hardware, connecting it to a TV screen and showing these photos. If should be able to switch the photos manually (using a button) or automatically in a dia-show.
It should support several TV resolutions and it should be connectable to my PC (USB prefered), so that I can upload and delete photos.
So where to start and how to do that?
Thank you in advance, Andreas
If your aim is just to show some photos, there are assuredly simpler and more cost effective ways to do so; devices exist which do more or less exactly what you are proposing.
If your aim is to learn about microcontrollers and this is a project your are taking up to further that, I would recommend looking into the Arduino: http://www.arduino.cc/ or a similar kit based micro, and growing your project from that.
Microcontroller + low level language will be a huge pain to work with, particularly if you wish to handle various file formats and screen resolutions. Get a full-blown computer with an OS instead - something like http://en.wikipedia.org/wiki/PC/104
If your goal is purely to be able to display photos then I would recommend using a digital camera with video out capabilities.
If your aim is to learn about electronics and microcontrollers I would start with a good book and an Arduino board. Note that writing microcontroller code to handle file systems, image formats and video output is non-trivial. Simpler projects may be a better starting point as they are more accessible resulting in quicker progress, less frustration and more motivation!
The engineering field is a interesting field. You can start with the web site "www.microchip.com". You will need a high end device consider the PIC32MX795L512, there is a nice starter kit for it, "Ethernet Starter Kit" http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2615&dDocName=en545713. This kit has the on board debugger & programmer to do all the hard work.
You get sample projects with the package, you can program using ansi c programming.
IDE : MPLAB which is free, and the C32 compiler has a student/lite version.
Arduino also has a board with the same device.
I personally like "www.techtoys.com.hk", they have device compatible with Microchip boards like techtoys.com.hk/PIC_boards/PIC32STK%20SSD1963%20EVK/PIC32STK%20SSD1963%20EVK%20R1A.htm, or this techtoys.com.hk/PIC_boards/PIC2432EVK-RD4/PIC2432%20EVK%20RD4.htm where this board you will need a debugger/programmer like the low cost PIC Kit 3 "microchip.com/pickit3".
The trouble is you need to write the HDMI video library yourself, there are some VGA libraries available but they are only black and white and very hard to get color with these analog images. The rest of the libraries are already there, USB MSD(flash drive), SD Card, pictures (jpg) etc.
microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en547784
Feel free to contact me if you need some help, I might be able to help with the HDMI library.
It's a lot of fun to play with these toys.
Regards
Lucas
B-Eng Digital Engineering.
imlucanio#yahoo.com (no spamming)
Remember to add the http and www to the web links.
It sounds like you want an iPod. That is a dead simple thing to work with and it does everything you want. Otherwise, very complicated. I'd suggest the BeagleBoard and embedded Linux. Yes, it warrants that level of complexity.
The options for small microcontrollers just aren't there. The Arduino is very popular and yes, you can interface an SD card to it. That'd be your storage. Yes, you can put a digital potentiometer on it, that can be your interface. I've seen some video overlays that do simple text, but never any JPEG display (too much processing required). And certainly no 24 bit color (so that the output would actually look good) - that would take WAY too many pins to do correctly (and the Arduino doesn't have a D/A converter! You'd have to rig something up that would suck). And even then, all of the options for TV out weren't HDMI, but RCA (the old red/white/yellow cables).
So in short, no. Get a computer. That's what can do the job.

Assembler IDE/Simulator for beginner [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'd like to learn how to program in Assembler. I've done a bit of assembly before (during my A-Level Computing course) but that was very definitely a simplified 'pseudo-assembler'. I've borrowed my Dad's old Z80 Assembler reference manual, and that seems quite interesting so if possible I'd like to have a go with Z80 assembler.
However, I don't have a Z80 processor to hand, and would like to do it on my PC (I have windows or linux so either is good). I've found various assemblers around on the internet, but I'm not particularly interested in assembling down to a hex file, I want to just be able to assemble it to something that some kind of simulator on the PC can run. Preferably this simulator would show me the contents of all the registers, memory locations etc, and let me step through instructions. I've found a few bits of software that suggest they might do this - but they either refuse to compile, or don't seem to work properly. Has anyone got any suggestions? If there are good simulator/IDE things available for another type of assembler then I could try that instead (assuming there is a good online reference manual available).
I've found a few bits of software that suggest they might do this - but they either
refuse to compile, or don't seem to work properly. Has anyone got any suggestions?
Write one. You're best off picking a nice, simple instruction set (Z80 should be perfect). I remember doing this as a first-year undergraduate exercise - I think we wrote the simulator in C++ and simulated 6800 assembly, but really any language/instruction set will do.
The idea of "learning assembly language" these days is to get the idea of how computers work at the lowest level, only a select few (compiler writers, etc.) have any real reason to actually be writing assembly code these days. Modern processors are stuffed full of features designed to be used by compilers to help optimise code for speed/concurrent execution/power consumption/etc., and trying to write assembly by hand for a modern processor would be a nightmare.
Don't fret about getting your application production-ready unless you want to - in all likelihood the bits of software you've found so far were written by people exactly like you who wanted to figure out how assembly works and wrote their own simulator, then realised how much work would be involved in getting it "production ready" so the general public could use it.
You might want to check out the open source 8085 simulator "GnuSim8085", it's specifically meant to be used for educational purposes, and it was in fact written by student while preparing for his exams. It runs on both, Linux and Windows.
WinApe is a good emulator of an Amstrad CPC. The Amstrad CPC was a Home Computer produced in the 80's. It used a Z80 as its CPU. Using the emulator you can display a lot of the internals while programming. It includes a debugger and a disassembler for Z80 code.
If Your are on windows 8085 Simulator is the best choice.
It user interface is excellent than any other simulator. Also this simulator provide live view of memory map very time(also while in the execution).
But this one does not support Windows 98 or lower for that you need to check other simulators like GNUSim8085.
MipSim is FREE
Main Features of MIPSim 2
Built-in code editor with features like syntax highlighting and folding
Display register and memory values in different representations (signed integer, unsigned integer, hexadecimal and ASCII)
Set the block size (full-word, half-word, byte) of the memory cells for easier examination of the memory values
Change values of registers and memory cells with a single click even during simulation and debugging
Realtime user-interface updating allows you to see how values of registers and memory cells change during execution
Built-in debugger with step-by-step instruction execution, instruction skipping and breakpoint features
Tools for inserting ASCII, UNICODE strings and integer values to memory for testing of your code
Tools for checking duplicate or missing labels and instruction parameters
Save computer state (values of all registers and memory cells) so that next time you run the simulator you can continue from where you left!
Set the simulation speed - low speeds are great to trace your code and to see how it behaves
Encode instructions - produce machine code in either binary or hexadecimal representation
Catch assembly time and runtime errors
Easier debugging with descriptive error messages
Multi-threaded design - MIPSim doesn't get stuck (hopefully ;) even if the assembly code executed is erroneous or contains infinite loops
MIPSim API - make your own programs that can read from and write to the registers and memory of MIPSim, great flexibility for powerful testing!
Aim higher! Try and get a simulator for a more powerful assembly language. Remember, Z80 and 808x were low-end processors with low-end and awkward instruction sets.
Something like VAX from DEC was regarded as the Rolls-Royce of instruction sets. And then there are crazy Risc instruction sets that do some really strange things. Maybe you can find definitions of those so that you can have a crack at implementing them.
You may be interested in this for a Z80 simulator, and I've had good experiences with WinAsm.
You might also consider learning x86 assembly language, which you could do using in-line assembler in Visual Studio - although it's a larger instruction set than Z80, you would have the advantage of being able to use much better tools than would be available for the Z80.
I've also just remembered that the Keil 8051 and Arm tools have a simulator in the IDE - there are size-restricted versions of these available for free download from www.keil.com
If you happen to already know .NET, then this may be of use:
http://www.viksoe.dk/code/asmil.htm
It's a little bit limited, and may only work with .NET 1.1, but you could atleast use a "modern" IDE for it, and there are plenty of docs around for it.
<%# page language="Asm80386" %>
<%
Str: DB "Testing...", 0
mov eax, -2
cmp eax, 2
jle Label1
xor eax, eax
Label1:
lea esi, Str
push esi
call "Response.Write(string)"
pop esi
%>
<br>EAX: <%= eax %>
Another option, if you want to go "hard core" is get something like FreeDOS and VMWare, and use that. I'm sure a garage sale (car boot sale? yard sale?) or second hand book shop would have a copy of Peter Norton's old DOS interrupts bible. :)
Personally, I learned x86 asm by using Turbo Pascal (which I think is now free from Borland?), which had the ability to embed assembly instructions inside a function. Made it easier to setup the app, and I could focus on the stuff I wanted to do. I later used MacVAX at Auckland Uni, which was ok, but the VAX is very much dead - you may as well learn x86 :)
SimpSim is definitely worth a look. It's Windows only, but the feature set is pretty decent:
Main memory and register display
Built-in editor with syntax highlighting
Run, step, and break functions
This wouldn't make any meaning to you now but just for people stopping by. This is the best assembly code simulator I have come across with. Truly worth it!
http://www.emu8086.com/
Take a look at Thomas Scherrer Z80 Emulators for a listing of potential emulators you could use.
I write z80 asm for the ZX Spectrum (still, I know :) ) and use SJasmPlus to link to a spectrum emulator file. Lots of of the better Spectrum emulators like Fuse and ZXSpin have built in editors as well for on the fly debugging and patching.
When I was in college we used PIC microprocessors. They are made by a company called Microchip. They also have a great IDE with a chip emulator/simulator that can allow you to do things without actually having the chips.
Why use an emulator?
Download MASM or NASM and write good old 80386 architecture. Plenty of online samples and learning tools.
Plenty of real-world reason to use assembler!
there is a simulator which is Visual6502 for teaching fundemental of microprocessor architecture. It has a editor, assembler, I/O operation and animation of how to work a microprocessor. I is available at the following link.
http://www.pcsistem.net/visual/index.htm

Resources