I have a 16-bit wide RAM that doesn't have the ability to be byte addressed. However, the compiler is compiling the code with instructions that write single bytes. This is resulting in data overriding other data. Is there a way to tell the compiler that the memory can only be accessed using 16-bit data so that my RAM doesn't get corrupt?
Is there a way to tell the compiler that the memory can only be accessed using 16-bit data so that my RAM doesn't get corrupt?
No, there is not. You can try some workarounds, though. For example, 1) Perform all accesses to the 16-bit RAM through dedicated functions. The functions will do the necessary magic. 2) If possible, use a portion of address space accesses to which cause exceptions. Perhaps, you can intercept those exceptions and use them to access your RAM instead.