overlap local variables with stack area
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-17 9:08 AM
overlap local variables with stack area
- Labels:
-
Legacy Products
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-09 4:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-12 1:52 AM
It is because you are using the stack model (+modsl) which uses the physical stack. So either you can use memory model which uses the simulated stack or use @nostack option in order to forcibly use simulated stack by the compiler. For more details please refer cosmic compiler manual (Memory Models Section).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-12 10:37 PM
hi jatin,
I've changed to +modml, and it still reset the stack pointer by 'rsp' (in crtsx.s) put the SP at 0x1ff. (phycical address). How can I allocate the SP in any address I'd like to for ex. SP=0x87f ? thanks, atz- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-13 5:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-13 5:30 AM
hi loca
as I explain above there are overlap of local variables in some subroutins with stack area. when the software run in these subroutines the system crach and reset is being occured. I'd like to prevent this overlap. I'd like it will transparent to me as a cosmic user compiler and not take care evry time I'll add a subrotine with parametres and loacls. atz- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-13 9:03 PM
Datz,
as Jatin explained, it's normal that in stack mode (mods, modsl) all the local variables (including function parameters) are in the stack. This is done to allow reentrancy. The code and stack values you show in the original post look correct to me, so the problem is probably somewhere else. Can you specify which instruction exactly causes the ''crash'', what you mean by it (execution out of code, chip reset, the debugger hangs...) and how you go about to debug (which hw, which debugger, step by step or bkpt...)? If you can reproduce the problem is simulation you can post the whole code here and I'll take a look. Regards, Luca (Cosmic)- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-15 3:34 AM
hi luca
My project is about 40K I cant deliver it. anyway I don't think there is a software problem. I think there is a problem in the the cosmic link phase. if the ram location(0100-0x1ff for ST72F521) is deticted to stack area, the link phase must avoid addressing locals,parameters,globals in that dynamic stack area. In any compiler you can allocate the stack pointer at the linker by switche declareion. I see at lkf this command: # define the __stack symbol for stack models only # +def __stack=0x100 # stack page ( stack models) but there is no Influence because in map file I see: __stack 00000100 defined in command file *** not used *** and it does not change of any +def=0xnnn what the ' *** not used ***' means, while in run time the stack is very active and SP start address is 0x1ff. atz- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-15 10:43 AM
The __stack declaration in the linker file is not used anymore by the cosmic compiler.
The stack pointer will be set to 0x1FF by the device reset, or via 'rsp' instruction. The stack pointer can be changed but why would you want to unless you are writing a multitasking os, for example. I think more information is required to help you further: Regards sjo- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2004-04-15 12:24 PM
Hi forum,
please see the attached file. it is a snapshote of run into the routine. note to the SP value, the locals and parameters addressing are in same area location. the return PC of the called subroutines whish stored in stack are crached. the PC run out of program and the watch dog reset the system. I've only changed the length buffer from 2 to 6, and system which runs for weeks, sudanly crach. it is a critical bug! atz ________________ Attachments : overlap.doc : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0Aj&d=%2Fa%2F0X0000000bVP%2FcoAYqFrmNGBZ3SXUJ36W0VufPDkBTgk8ZE5yk569xGs&asPdf=false