Hello :)
I am new to 8051 family programming and I have a question. I would like to know if there is anyway, somehow, to put another software in a memory and load it from 8051 to run on it. It would work similar to plugins :)
Speaking in C language, it would be like a function inside the memory that do something. That function receives a pointer to a structure that has many other functions that the main software inside the microcontroller has, like display things on a screen. Well, is very similar to plugins :)
Is this possible? With other microcontroller maybe?
If I said something wrong or confuse please, let me know! Thank you!
Just a quick note here. If you are going to do something with a graphics display, the amount of work will quickly explode. And the amount of load on the processor will also increase. Please look at an ARM chip. It is a way more general processor, reducing the amount of time you will have to fight with the processor.
But an even more important thing. Don't start too ambitios. Start with something simple. Get it to work. Then spend time thinking about how to extend it. Better to end up with a solution that only plays one game - such as tetris or some board game - than to have spent a lot of hours and end up with an unfinished product. The important thing is to do something that regularly gives you positive feedback. Progress is very important.
If you decide to continue, after having a working platform, quite a lot of simpler games can be implemented as byte-coded applets.
The general concept of a library is quite advanced. A real library requires linking. Either dynamic or static. But that linking step requires you to know how to update references inside the code, to make a call or variable reference from one module end up reaching the correct function or variable in another module. It is a very complex concept, unless you not only are very good with C (and possibly assembler) and are good at extracting information from the compiler output files. The C51 compiler is totally unsuitable for this, because of how the C51 compiler interacts with the linker.
And switching to a solution with function pointers requires a processor that is comfortable with pointers which means that you want a general-purpose processor with good I/O abilities. The 8051 chip is not general-purpose. It is very good at bit-access I/O, but falls short when it comes to general pointer and memory manipulation.
Whatever route you decide to do - implement a single game, try a byte-coded virtual machine or implementing a BIOS-style solution with function pointer arrays or similar - do not (!) select a 8051 chip. Just about any other chip would be better. I like ARM chips, but there are several other architectures that will all be way better than a 8051 chip for this kind of project.
So select a GP processor, start small and then see where you end up.
No, it will be open source. Its just to not let the user mess with the screen control or buttons, dunno, I am constructing the idea :)
Well, it would be easyer if he uses the sample codes to handle the screen, buttons, etc... There is anyway to create libs? But I would like to add a start routine that the user cannot change. The user needs to easily save the program into the microcrontoller, without the need to buy something special.
The main idea is to let the user create softwares for a hardware, then he could save it on the hardware as easy as pie. And he needs not to overwrite other softwares that he created, so there will be a list that he choose to run on the microcontoller, is this too confusing?
Ok, I will tell what I will try to do (and some friends). Its a work that my teacher asked, we need to do something with a microcontroller (dont need to be 8051), and we would like to make a very simple minigame, that we could create the games and easily put it on the minigame! Then there would be a list of the games that it contains, and we would choose one to play.
:)
I would start with another question. Why? Why do you want to implement plugins? To add functionality at a later stage? The normal way would be to update the full application at that time.
To let an end-user add new functionality, without giving away the full source code? Another way of doing this would be to implement a virtual machine, that runs a byte-coded application. This would be similar to the programs to write for a programmable pocket calculator, or the macros you use in a spreadsheet.
I didnt think about that, but it would work as a computer :o
Anyway, you all said hard terms and complex names that I dont understand very well, I am a begginer on microcontrollers :) I have a good experience in programming, only on PC.
So, 8051 family is not a good choice to make that? What should I choose?
software in a memory and load it from 8051 to run on it
sure, but a "wrestling match", the '51 is a HARWARD architecture and thus not a good choice for such.
There has been hundereds of attempts to make "the '51 PC" all have failed.
If it is a matter of 2 or 3, I have seen it done with an "external flash selector".
Anyhow, your post is not in "'51 language" read up on "the bible" and reformat your question and you can get a clear and definite answer
Erik
here are the links to "the bible" Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf
look at the upsd from st. you can map different flash blocks to one adress. so good. the upsd's are to be discontinued, if I recall, last shipments in may.
HI.
yes it is posibble and quiet easy. it can be like the bios of a pc runnning apps. but you will probebly have to wright it all.
look at the upsd from st. you can map different flash blocks to one adress. so good.
but do not look for the scatter file in 8051 from Tapeer. he an arm man and does not know the 8051 uvision projects do not have scatter files.
Always yo're freind.
Zeusti.
Of course it is possible. You can see it on desktop PC's all the time when you launch programs. Nothing prevents you from implementing similar functionality on a 8051 MCU. But this kind of task is not for a novice programmer. You should be familiar with OS design techniques in order to do this. And the 8051 is certainly not the best architecture for this.
One of the possibilities to do this is to have separate regions in flash that are dedicated to a certain functionality, and will be programmed by separate targets of a uv3/4 project or a separate project. so, the main program will reside starting at the well know entry point to flash, and when necessary it will jump to and execute code residing somewhere else. you can distinguish between these zones with a scatter file or have a separate such file per "plugin". do note that you would have to introduce a mechanism that would prevent the chip going astray if no "plugin" is really installed...
View all questions in Keil forum