We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hey, I am trying to do a simple assignment where I am assigning one long to another. The left side of the equal sign is an element in a structure that is part of a union including other structures and a buffer array. It is referenced using a pointer to the union. The right side of the equal sign has an element of a structure that is also part of a union including a buffer array. command_data->status_struct.baseline = data_logger_status_0.status_data.baseline; It compiles fine, but when I run it, it cause the program to crash in a totally unrelated area of the code. In fact the function in which this snippet resides is not even called anywhere in the code for now. Does the C51 compiler have problems with longs?
Are you using any sort of linker controls or other means to absolutely locate other parts of the code at address 256? Does a boot loader or something similar assume that application code starts there? Any possible hardware issues decoding the top byte of program store fetches? What's special about address 256 with your part and board?
Well, who might have guessed. I turns out that it was a linker problem. All along I was using the memory layout from the Target Dialog window. This was putting code into my iterrupt vector space. After looking over some code on the Cypress web site I discovered that they do not like to use this window. They use the BL51 Locate window to keep this from happening. This would not be a big deal if Keil didn't tell me that putting code into vector space was OK. Peace, Joe
I put code in vector space. Of course, I avoid the addresses that I need for interrupt vectors for hardware that I actually use. But the rest of the code memory in the first page is fair game for other purposes. Does Cypress devices have some special restriction in this regard? It would be a good thing to remember if I ever have to use one in the future.