I am running into a very weird problem where the attached application doesn't boot up from the UART boot mode when the application is smaller or larger than a certain size. Let me try to explain:
The attached code is a simple application which will initialize the CGU and UART, then repeatedly poll for an incoming 0x7E from the UART port. Once it does receive the 0x7E, it will simply transmit a hundred 0x03 back to the other end.
The code uses the same linker script files (adsp-sc589.ld and adsp-sc58x-common-l2.ld from the "CCES\ARM\arm-none-eabi\arm-none-eabi\lib\sc589_rev_any" folder), but I merged the 2 files together and named it "adsp-sc589_L2.ld". The whole application is located in the l2_uncached_code section, so that ADI's system library are not interfering with the code placement while I debug the problem. If you look at the ARMcode.map generated, my main() function is the only thing that resides in the l2_uncached region.
When you look inside the main() function, there are a bunch of i++ at the end of the function. If all of them are commented out, the application will NOT run under UART Boot mode. In fact, it will only run when there are 51 to 132 i++ added to the main() function. There is a little table in there for the different results.
To be precise, I am not sure if the problem lies in my code or the UART Booting as I don't have any means to verify that. But if it works for some code size and doesn't for some other, I would think it is related more to my code that what the BOOTROM is doing. I am really scratching my head on this one, and hope some one can give me some directions on how to debug this.