2005-11-01 09:22 PM
Zero page - problem compile with Metrowerks
2005-10-20 08:09 AM
Hello All
I use ST7FMC2N6B6, which is used only on eval boards (my case it is starter kit for ST7FMC2 BLDC motor) It has 32KB of Flash and 1K of RAM (SDIP 56 pins). I compile and get link error *ERROR L1102: Out of allocation space in segment MY_ZRAM at address 0xF9* Can you tell me if MY_ZRAM is a term of ST, Softec or Metrowerks ?? (where do I read about it ??) I use Softec environment, and I had ''local vars'' set from 0x80 to 0xFF I change it to be from 0x80 to 0x17F, and now it linked OK. The problem is that I don't know if it is allowed to change this parameter like this, cause the ZRAM, as I understand, is for ''near'' variables, with addresses up to 0xFF. Any hint ? Thanks Oren2005-10-23 10:19 PM
Hi,
This message comes from the linker. If you use Metrowerks one, the MY_ZRAM parameter is defined in the PRM file. Best regards Laurent2005-10-24 03:20 AM
Thanks Laurent
I afraid I am still doesn't get it. :-[ I know taht the message comes from the linker. I wrote it in my question (that I get link error) When you work with Softec STVD, the prm file is automatically created, BUT (I think) that the linker is the linker you use, in the tool chain - in my case is Metrowerks. So my question is still stend: if MY_ZRAM is a term of ST, Softec or Metrowerks ?? (where do I read about it ??) Also can somebody refer to the second problem I asked about: I use Softec environment, and I had ''local vars'' set from 0x80 to 0xFF I change it to be from 0x80 to 0x17F, and now it linked OK. The problem is that I don't know if it is allowed to change this parameter like this, cause the ZRAM, as I understand, is for ''near'' variables, with addresses up to 0xFF. Any hint ? Thanks Oren2005-10-26 02:36 AM
MY_ZRAM is a default name for segment between 0x80 and 0xFF, generated by STVD7. Usually, it is used for local variables because of SHORT addressing mode, which could be used. In fact, it is faster to access this area and spend some bytes in code as well. If you will extend this space to 0x1XX, your code will be not so effective, as it could be (because FAR addressing will be used for some local variables).
maybe you can try to limit number of local variables? do you have some local¤s defined as STATIC? those will be in RAM all the time, maybe you can force compiler to put them into MY_RAM, instead of MY_ZRAM...2005-10-26 06:05 AM
Hello
Thanks a lot. Two final questions: 1. how do I force compiler to put them into MY_RAM, instead of MY_ZRAM ? 2. In the data sheet of the ST7 it says that the stack is from 0x100 to 0x1FF. If I enlarge the MY_ZRAM up to 0x17F, then one ''problem'' is that for some of the variables (above 0xFF) the compiler will use long addresses. (you explained) My question is: does the stack location can be determine also ? I mean, I will force the stack to be from 0x180 up to 0x300 for example, and then use the rest of the RAM as usual, OR the stack is hard wire determine by the CPU, as in the data sheet ? Thanks lot Oren2005-10-26 11:37 PM
Hi Oren,
please have a look at your xxxxx.prm file. There you can define different sections in the block titled SECTION, e.g. ZRAM = READ_WRITE 0x0080 TO 0x00FF; RAM_2 = READ_WRITE 0x0100 TO 0x017F; MYSTACK = READ_WRITE 0x0180 TO 0x01FF; In the block PLACEMENT you assign a segment to a section e.g. BSCT INTO ZRAM; RAM_SEG_2 INTO RAM_2; Finally in your program you must assign your variables to the very segments with a #pragma directive e.g. #pragma DATA_SEG SHORT BSCT int rxNb = 0; #pragma DATA_SEG NEAR RAM_SEG_2 short int Test; unsigned short int ErrorNo; #pragma DATA_SEG DEFAULT See above for your 2nd question: You define the stack area in your .prm-file with MYSTACK = ... Best regards WoRo2005-10-27 01:53 AM
Hello WoRo
From your answer I anderstand I can put the stack in address where I want to. Am I allowed also to make the stack go over 1FF ? Am I allowed to define MYSTACK (as in your example), for example, from 0x180 too 0x400 ? So why there is limitatin in the datasheet - i.e. chips with 1024 bytes of stack, chips with 768 bytes of stack, and so on ? Thanks Oren2005-10-27 03:10 AM
Hello Oren,
you can generate a new RAM segment from 0x0200 to 0x0400 with the .prm-file but I think you must give the stack an area from 0x01yy to 0x01FF. Notice: the command RSP (Reset the Stack Pointer) will reset the pointer to the maximum value of 0x01FF - independent of the program. Regards WoRo2005-10-27 04:58 AM
:D
Thanks a lot That RSP command was a big tip. I now looked also aanother document 4020.pdf (programming manual of assembler, and it help also) I am very grateful to you. Oren