[SOLVED] self programming avr , operating system simulation .

so i managed to get a method to load a program from the SD card in the bootloader . so the bootloader checks for a flag in the boot sector of the SD card , and that flag points at a file . so when i want the program to load hexadecimal content af a 64kb space in the flash , i set the flag with the file name and then do a chip reset to log to the bootloader .

now the issue is , what am i even loading ? the hexadecimal file ? at the 64kb space .. will it mess with the rest of the content ?

+what if i want to use functions that exist in the main program ? can i just make a call to the address of the function and that's it ?

+what about the RAM or the SRAM usage . the compiler of the program that will be placed in the 64kb space does not know that there is an other main program that using half the ram , and that is should not mess with that space ? can i restrict the compiler to a certain ram space ? .
the main registers though are not a problem ,since i can push and pop them .

--> though if that is not possible there is another solution , i can just put a file that is the main os , so if the flag is not set , the bootloader would just load the main os but if it would be set it would load the program . so at every execution the whole system program would be erased to put the program that i need to execute .

+though i heard that hex files are written in a certain way that requires processing , isn't it just the hexadecimal data of the main assembly commands with arguments in order ??

so what if someone would use an avr with a 32bit processor , and like a 100 pins . then add a decent 32bit external ram to it . and then connect a keyboard and an sd card .and then add equip it with a simple monochrome video generating code . then can you write assembly code and get the avr to program itself ?
i know that might not be useful for a semi-serious application . but a self-programming avr would be a cool thing to have .

is the idea that stupid ?

amine2:
is the idea that stupid ?

This one?

then can you write assembly code and get the avr to program itself ?

Yes, the idea is that stupid.

If, by "program itself" you mean write it's own code.

If you mean something else by "program itself" then the AVR is NOT programming itself, and using that term is stupid.

by "program itself" i only ment , the avr writing hex files to itself via an SD card . i dont understand how that's stupid , can you instead help me with the problem sir ? :stuck_out_tongue:

by "program itself" i only ment , the avr writing hex files to itself via an SD card

That's like saying that avrdude is programming the chip today. It is NOT. It is copying a hex file that the linker created from some object files that the compiler created from some cpp files that the preprocessor created from some files that the Arduino IDE manipulated from the contents of the window that a user typed some code in.

If you want the bootloader to copy the data from a file on an SD card, rather than having avrdude send it data, feel free to modify the bootloader to do that.

Why not try to explain what you really want to do, in simple language, rather than misuse technical terms that you don't yet understand.

What has "self programming" go to do with "operating system simulation" ?

The Arduino does not use an operating system - that is its strength.

...R

look , the people i am working with want a screen menu , that the can select the needed program with .. so i must have many hex files on the SD card ,the device boots up and starts a monochrome video of this menu thing . they are using an atmega644 "sanguino" . i dont know why they want to use an AVR for such a thing , i cant even argue i must do it . english is not my first language , french is my second language and english is 3rd

i dont know what the right thing to use for this is , kernel ? operating system ? or just bootloader ?. it is just a program that would let you select an other program from a list of programs .

First, there is a French section of the Forum if that would be a better match for your language skills. However your English seems quite reasonable.

An Arduino is intended to have just one program in it at one time.

What sorts of thing do your "people" want to be able to choose between ?

It seems unlikely that at one time they want to control a coffee-maker and another time they want to control the door to a chicken coop.

Assuming they just want to choose between different options for a broadly similar system a simple way to do what you want would be to create a single program with several functions any one of which can be selected using a menu.

An example might be choosing different flashing patterns for a set of LEDs.

Tell us what you want to achieve (what the end-product will be like) not how you think it should be implemented.

...R

ok sir here is it , these people are making a system for industrial use , i dont understand why they did pick the atmega644 . they dont want to have it reprogrammed via usual measures for some reason , they just want programs in the memory card , and then they should be transmitted to the machine . the thing is , the atmega644 seems to be looping over the same programs over and over again with a hold time in bettween. so you put a series of programs in the sd card and set some flags , then the device goes through all of them . besides there are some files they want the programs to access on the memory card . i cant understand why they want an atmega644 for this

amine2:
ok sir here is it , these people are making a system for industrial use , i dont understand why they did pick the atmega644 . they dont want to have it reprogrammed via usual measures for some reason , they just want programs in the memory card , and then they should be transmitted to the machine

Your job, as the "expert" is to explain that it does not work like that. Earn your fee.

And you still have not explained what sort of different things they want to do with the different programs.

...R

basically it's a series of programs . the goal is to get the atmega644 to load them one by one . following a flag pattern . i am not the only person working on this project . i am working on programming .

amine2:
basically it's a series of programs .

I think that is the third time you have told us that.

I want you you to tell us what each of those different programs will do.

...R