• AVR Freaks

Hot!Variable in EDS (for sure)

Author
Wieschebrock
Super Member
  • Total Posts : 224
  • Reward points : 0
  • Joined: 2005/01/22 07:57:44
  • Location: Germany
  • Status: offline
2020/03/11 04:23:54 (permalink)
0

Variable in EDS (for sure)

I have a data array on a PIC24FJ256DA210 that should be located in the EDS memory space (0x8000 and above) and so I declared it as
 
__eds__ SCRN_DATA scr_data[MAXSCREEN] __attribute__((eds));

 
But it seems to need an extra attribute, because, depending on the link process, it is not always located in the EDS memory:
Map file:
0x6fa0 _scr_data  
0x8000 _activeLanguage
 
How to declare the variable to be sure that it is really allocated in the EDS ? 
 
Thanks.
post edited by Wieschebrock - 2020/03/11 06:42:59
#1

12 Replies Related Threads

    JPortici
    Super Member
    • Total Posts : 925
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/11 07:15:15 (permalink)
    +1 (1)
    This is how i declare variables in EDS
    __eds__ uint16_t __attribute__((space(eds))) variableInEDS;

    #2
    Wieschebrock
    Super Member
    • Total Posts : 224
    • Reward points : 0
    • Joined: 2005/01/22 07:57:44
    • Location: Germany
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/11 07:50:31 (permalink)
    0
    Jack_M
    This is how i declare variables in EDS
    __eds__ uint16_t __attribute__((space(eds))) variableInEDS;


     
    Compiler guide says that: 
    __attribute__((space(eds)))

     is equivalent to
    __attribute__((eds))

    so this should be the same:
    __eds__ uint16_t __attribute__((eds)) variableInEDS;

     
    The variable name is the last part after __attribute__.
    But in the compiler guide I also find:
    __eds__ unsigned int var[10] __attribute__ ((eds, page));

    With __attribute__  at the end.
     
    Thanks for your reply.
    I will try if it makes any difference.
    #3
    Wieschebrock
    Super Member
    • Total Posts : 224
    • Reward points : 0
    • Joined: 2005/01/22 07:57:44
    • Location: Germany
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/11 07:56:10 (permalink)
    +1 (1)
    __eds__  SCRN_DATA  scr_data[MAXSCREEN]  __attribute__  ((eds));

    and
    __eds__  SCRN_DATA  __attribute__ ((space(eds)))  scr_data[MAXSCREEN];

    produces the same code.
     
    scr_data is not (always) located in EDS.
     
    Btw: My resulting problem is that the memory left in the lower 0x8000 bytes of the memory gets to less for the heap and the stack (and the other data)
     
    post edited by Wieschebrock - 2020/03/11 08:01:28
    #4
    Wieschebrock
    Super Member
    • Total Posts : 224
    • Reward points : 0
    • Joined: 2005/01/22 07:57:44
    • Location: Germany
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/25 00:32:44 (permalink)
    0
    Hmmm, has no one an answer, or is the question to trivial?
     
    How can you ensure that a variable is always created in the EDS memory area? By the linker, not by specifying the absolute memory address.
     
    Thanks for your help.
    #5
    ric
    Super Member
    • Total Posts : 26159
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Variable in EDS (for sure) 2020/03/25 19:38:07 (permalink)
    0
    Maybe no-one here knows.
    It may be time to open a support ticket with Microchip.
    www.microchip.com/support
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #6
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11681
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/25 20:08:11 (permalink)
    0
    I believe it needs to have static storage duration; it's not clear from your declaration if it does.
     
    I have always done
     
     __eds__ object_type object_name  __attribute__((eds));
    #7
    ric
    Super Member
    • Total Posts : 26159
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Variable in EDS (for sure) 2020/03/25 20:12:57 (permalink)
    0
    jtemples
    I believe it needs to have static storage duration; it's not clear from your declaration if it does.

    Indeed. Another case where a single line of code is not enough information.
    It matters WHERE this line of code is.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    Wieschebrock
    Super Member
    • Total Posts : 224
    • Reward points : 0
    • Joined: 2005/01/22 07:57:44
    • Location: Germany
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/26 00:26:03 (permalink)
    0
    Thanks a lot for your reply jtemples and ric.
     
    The variable is defined in a global scope of the compilation unit and declared in other files using the "extern" keyword 
     
    I thought I missed something when gambling with the esd stuff.
    But it might be a compiler issue.
    I remember that I wrote a hand full of ticket regarding the esd stuff prior to XC16 v1.36. There were a lot of compiler bugs with the memory handling. 
     
    So it seems that it its time for a ticket.
    Again, thanks  for your help.
     
     
    gui_data.c:

    #include <xc.h>
    #include <time.h>
    #include <stdint.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <stdbool.h>
    #include <string.h>
    #include <math.h>

    #include "gui_data.h"
    #include "system.h"
    #include "vgdd_main.h"


    // this array collects all data that can be shown on the screens.
    // __eds__ SCRN_DATA scr_data[MAXSCREEN] __attribute__ ((eds)) ;
    __eds__ SCRN_DATA scr_data[MAXSCREEN] __attribute__ ((space(eds), section("scr_data"),address(0x0016400)));
    (...)

     
    #9
    JPortici
    Super Member
    • Total Posts : 925
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/26 01:59:12 (permalink)
    0
    In any case i *don't* think an auto can be put in EDS.
    can the stack reach EDS? I don't think so..
    wouldn't the compiler have to mess with PSV at every stack access, so stack access wouldn't be atomic anymore?
    Probably the same reason why the heap won't be allocated in EDS.
    #10
    JPortici
    Super Member
    • Total Posts : 925
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/26 02:02:18 (permalink)
    0
    thinking about it even further... what's the problem if part of your array is not in EDS?
    the compiler will access to it in the same ways as if it was..
     
    is some other variable put in EDS instead?
     
     
    #11
    ric
    Super Member
    • Total Posts : 26159
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Variable in EDS (for sure) 2020/03/26 03:59:10 (permalink)
    0
    Wieschebrock in post#4
    ...
    Btw: My resulting problem is that the memory left in the lower 0x8000 bytes of the memory gets to less for the heap and the stack (and the other data)




    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #12
    Wieschebrock
    Super Member
    • Total Posts : 224
    • Reward points : 0
    • Joined: 2005/01/22 07:57:44
    • Location: Germany
    • Status: offline
    Re: Variable in EDS (for sure) 2020/03/26 04:11:20 (permalink)
    0
    Hi JPortici
    Hope your and yours are well.
    The scr_data has about 14k. If the linker puts it to lower ram there seems to be a problem with less of stack.
    But I am not sure.
     
    The project is a graphic display project with tons of code generated by VGDD. The display stops at start screen.
     
    Why do you think it is an auto variable? It is defined outside of any function.
     
    ...stay healthy
    #13
    Jump to:
    © 2020 APG vNext Commercial Version 4.5