l.s., Has anyone experienced problems with declaring a local array and passing the first element of the array address as a parameter of a function? When this is done(sometimes....) the array is in C: memory. When the array is declared static globally the problem does not occur, the array is in X: mem. Used are RTX tiny and reentrant functions. ***.
Hello ***, Could you describe your problem more detailed (code example)? What toolchain are you using (C51, C166)? best regards Franz
Hi Franz, Thanks for your reply, i needed more time due to beautiful weather and a day off. Below some sample code. When 'BYTE nvm_value[2];' is declared locally in this function a C mem address is passed to STOR_GetEqualizerPreset. When declared globally a X mem address is passed. I always forget to select the correct toolchain, sorry, it is C51. regards, ***. ERRCODE sp_SetEqualizerPresets(void) reentrant /***********************************************************************************/ /* Input(s) : */ /* Output(s) : */ /* Description : */ /***********************************************************************************/ { ERRCODE Err = ERR_OK; BYTE index; BYTE equalizer_word = 0; BYTE word_1_lsb = 0; BYTE word_2_lsb = 0; //BYTE nvm_value[2]; WORD Address; WORD Value; for(index = 0; index < MAX_EQUALIZER_COEFFICIENTS; index = index + 2) { STOR_GetEqualizerPreset(index, &nvm_value[0]); Value = nvm_value[0]; Value <<= 8; Value = Value | nvm_value[1]; if((equalizer_word % 2) == 0) { Address = EQUALIZER_RAM_BASE_WORD_1 + word_1_lsb; word_1_lsb++; } else { Address = EQUALIZER_RAM_BASE_WORD_2 + word_2_lsb; word_2_lsb++; } equalizer_word++; sp_WriteEqualizer(Address , Value); } return Err; }
1. What version of the tools are you using? 2. Have you configured the reentrant stack in the startup code and did you include the startup code in your project? I tried your example and it worked just fine. I'm using the latest tools (V7.01). Jon
Hi Jon, Below a part of the startup code. I'm using v.7.00 of uVision, however, this occurred in the previous version aswell. The problem is that this does not occur in every declaration. It happened that everything was just working fine, however after adding some code elsewhere this just came up. A collegue of mine had the same problem in different code. It is hard to reproduce but we will monitor this better in the future. Perhaps we can supply you then with a better problemdescription. thanks, regards, ***. ; Reentrant Stack Initilization ; ; The following EQU statements define the stack pointer for reentrant ; functions and initialized it: ; ; Stack Space for reentrant functions in the SMALL model. IBPSTACK EQU 0 ; set to 1 if small reentrant is used. IBPSTACKTOP EQU 0FFH+1 ; set top of stack to highest location+1. ; ; Stack Space for reentrant functions in the LARGE model. XBPSTACK EQU 1 ; set to 1 if large reentrant is used. XBPSTACKTOP EQU 01EFFH+1; set top of stack to highest location+1. ; ; Stack Space for reentrant functions in the COMPACT model. PBPSTACK EQU 0 ; set to 1 if compact reentrant is used. PBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
OK, Download V7.01 and see if you still have trouble. There were a couple of problems that were fixed in V7.01 that MAY be what you are experiencing. Jon
As it says at the top of the form for submitting items to this forum (3rd bullet point), please use the < pre > and < /pre > tags when posting code (but without the extra spaces) - then your layout will be preserved.