STM8's compiler make a function puts its all local & temp vars on its stack.
However, it seems the only reason is the var is overwritten. Erik Petrich <epetr...@ivorytower.norman.ok.us>编写: > > >On Fri, 5 Sep 2014, r...@remi.lu wrote: > >> Hello >> >> SDCC : stm8 3.4.1 #9068 (Sep 5 2014) (Linux) >> >> I dont see the difference between this ( A and B ) : >> >> I have _lcdchar declared by : >> >> .area OSEG >> _varOne: >> .ds 1 >> _lcdchar: >> .db 1 >> >> .area CSEG >> >> . >> .which seems not working, at least the way variables >> are to mee in assembly ... >> . > >Assuming you aren't using a custom linker script, I think you should use >areas DATA and CODE instead of OSEG and CSEG. In particular, OSEG is >usually used to hold temporary values in functions that do not call other >functions because all of the OSEG areas overlay (the O in OSEG) each >other. So if your delay_m function also uses a variable in OSEG (or calls >some other function that does), this other variable is likely to be at the >same memory location as lcdchar, and so lcdchar is overwritten. > > Erik > > > >------------------------------------------------------------------------------ >Slashdot TV. >Video for Nerds. Stuff that matters. >http://tv.slashdot.org/ >_______________________________________________ >Sdcc-user mailing list >Sdcc-user@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/sdcc-user ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user