I am using the MC9S12Xeq512 processor as a new user. I had a problem when a c file had a global variable of type struct is declared. The program built ok using Cosmic but the app did not run. I changed the global to static const and all was well. The funny thing is that the global was only used by functions inside the file. Any ideas for this behavior. With this paged memory, are there rules of thumb for treating global and file scope variables?
Thanks,
David
I don't know Cosmic, but it seems that the problem could be related to static initialization. If you declare a variable as const it will likely end up in flash, and if ou don't declare it as const, it will likely end up in RAM. And then, if you pick a minimal non-standard startup code as is custom with most embedded compilers, the variable won't be initialized and contain garbage values.