Am 31.03.2018 um 10:42 schrieb Erik Petrich: > > I have enabled the assembler to emit 24-bit addresses in the relocation > records for stm8 like it does for ds390 and mcs51 (even though mcs51 is > only using 16-bit addresses). So this should allow you to reference the > individual bytes of the 24-bit address. However, I think additional work > will still be needed to reference the upper 16 bits of a 24-bit address. > > Erik
Thanks. That makes function pointers already quite useful for the large memory model, and I have made the corresponding changes in the compiler to enable that use. In particular, calls via function pointers work now, as do const global function pointers (initialized by the address of a function). The only thing that doesn't work is assigning the address of a function to a function pointer. For that we'd need the upper 16 bits of a 24-bit symbol: Code generation wants to load them into 16-bit register x using ldw. I have tried to just use #(sym >> 16) where 16 bits would be expected. However, that results in broken code: The linker seems to write 24 bits into the binary, overwriting the first byte of the following instruction. Philipp ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user