This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problems with longs

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?

Parents
  • 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

Reply
  • 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

Children
  • 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.