This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Mixed mode programming

I have developed a small Single Board computer, with a few customizations..

I am well versed in Assembly programming for 8052, but not for C. I have written driver functions for the devices on the board in assembly and this "BIOS" will be burned in the on-chip 20KB (89c55) eeprom as a simple monitor program. Upon startup, it will initialize some variables, a custom protocol stack and then jump to user program rom (at 8000h) address.

I want to write user codes in C, but in SMALL and / or COMPACT modes, since C uses the internal data ram for stack and other variables, this might clash with the BIOS variables that are at fixed internal-ram addresses.

Secondly, the BIOS program will initialize stack to reside in the extra 128-bytes ram (80h and above) while it is not certain where C will put the stack to start at.

Can anyone guide me as to how this situation can be avoided ?

Parents
  • If you really are well versed in Assembly programming for 8052, then you will find (nearly) all the answers to your questions by studying the startup code of the C application. It is written in assembler.

    Hint#1 - You will find that it IS certain where C puts the stack.

    Hint#2 - You will have to control where the linker places the relevant sections to avoid any nasty clashes.

Reply
  • If you really are well versed in Assembly programming for 8052, then you will find (nearly) all the answers to your questions by studying the startup code of the C application. It is written in assembler.

    Hint#1 - You will find that it IS certain where C puts the stack.

    Hint#2 - You will have to control where the linker places the relevant sections to avoid any nasty clashes.

Children