EmbeddedRelated.com
Forums

placing data at a specific location in flash

Started by Martijn Broens August 5, 2003
Hi all,
 
I've got a table that needs to be uploadable over a serial port. But I
don't know what the correct way is for me to define the table in the
files. I.e. the typedef and the enum never change so should be in
flash??, the table should be uploadeble and therefore should remain in
flash as well. But for some reason the consume data space. Can anyone
tell me what it is that I'm overseeing??
 
/*--------- msp430F149C.xcl --*/
//  Information memory (FLASH)
-Z(CODE)INFOA00-107F
-Z(CODE)INFOB80-10FF
-Z(CODE)FLASHPAGEN00-11FF
-Z(CODE) TABLECONTENT |00-7FFF
-Z(CODE)UDATA00-FDFF
 
//  Main memory (FLASH)
-Z(CODE)CODE,CONST,CSTR,CDATA0,CCSTR00-7BFF
 
/*--------- table.h --*/
// this data never changes
typedef enum e_resid{
            resMainMenuButtonText= 1,
            resMainMenuTitleText,
            resReturnButton, 
            resCaption,
//          ....
}e_resid;
 
typedef struct{
   U8                 MaxLen;
   e_resid          resNr;
   U8*               Caption;
} tLITabl;
 
extern   const tLITabl LayoutItemTbl[];
 
/*--------- table.c --*/
// table needs to be uploadeble by usart port
#pragma codeseg(TABLECONTENT)
tLITabl LayoutItemTbl[]{
            {15, resMainMenuButtonText,    "Enter here."},
            {0, resMainMenuTitleText,          "Mainmenu"},
            {0, resReturnButton,                  "Return"},
            {0, resCaption,                          ""},
// .... And a lot more of these
{0,0,0} // Last element from table!!!!!
};
#pragma memoryault
 
thanks,
Martijn
 





Beginning Microcontrollers with the MSP430

Martijn,

Far be it from me to be an IAR support engineer, but I think in table.c,
as you've not #included table.h, the compiler doesn't know that the
table is constant when it compiles the .c file.

I think you'll need:

const tLITabl LayoutItemTbl[]= ...

That's an "I think".  You'll probably also need to use some
other pragma
than codeseg, I would guess, too, as it doesn't go in the code segment.

-- Paul.

> -----Original Message-----
> From: Martijn Broens [mailto:martijn@mart...] 
> Sent: 05 August 2003 09:38
> To: msp430@msp4...
> Subject: [msp430] placing data at a specific location in flash
> 
> 
> Hi all,
>  
> I've got a table that needs to be uploadable over a serial 
> port. But I don't know what the correct way is for me to 
> define the table in the files. I.e. the typedef and the enum 
> never change so should be in flash??, the table should be 
> uploadeble and therefore should remain in flash as well. But 
> for some reason the consume data space. Can anyone tell me 
> what it is that I'm overseeing??
>  
> /*--------- msp430F149C.xcl --*/
> //  Information memory (FLASH)
> -Z(CODE)INFOA00-107F
> -Z(CODE)INFOB80-10FF
> -Z(CODE)FLASHPAGEN00-11FF
> -Z(CODE) TABLECONTENT |00-7FFF
> -Z(CODE)UDATA00-FDFF
>  
> //  Main memory (FLASH) -Z(CODE)CODE,CONST,CSTR,CDATA0,CCSTR00-7BFF
>  
> /*--------- table.h --*/
> // this data never changes
> typedef enum e_resid{
>             resMainMenuButtonText= 1,
>             resMainMenuTitleText,
>             resReturnButton, 
>             resCaption,
> //          ....
> }e_resid;
>  
> typedef struct{
>    U8                 MaxLen;
>    e_resid          resNr;
>    U8*               Caption;
> } tLITabl;
>  
> extern   const tLITabl LayoutItemTbl[];
>  
> /*--------- table.c --*/
> // table needs to be uploadeble by usart port
> #pragma codeseg(TABLECONTENT)
> tLITabl LayoutItemTbl[]> {
>             {15, resMainMenuButtonText,    "Enter here."},
>             {0, resMainMenuTitleText,          "Mainmenu"},
>             {0, resReturnButton,                  "Return"},
>             {0, resCaption,                          ""},
> // .... And a lot more of these
> {0,0,0} // Last element from table!!!!!
> };
> #pragma memoryault
>  
> thanks,
> Martijn
>  
> 
> 
> 
> 
> 
> ------------------------ Yahoo! Groups Sponsor 
> ---------------------~--> Buy Ink Cartridges or Refill Kits 
> for Your HP, Epson, Canon or Lexmark Printer at Myinks.com. 
> Free s/h on orders $50 or more to the US & Canada. 
http://www.c1tracking.com/l.asp?cidU11
http://us.click.yahoo.com/sO0ANB/LIdGAA/ySSFAA/CFFolB/TM
---------------------------------~->

.

 

">http://docs.yahoo.com/info/terms/ 



Hi Paul,
 
Thanks for the reply, i did include the .h file of coarse but these
where just snippets of code, the problem I'm facing is a more general
one. I thought that using the pragma would solve this for me, but I'm
unfamiliar with pragma's, have to look them up.
But I understand I'm going the rightway.
 
thanks,
Martijn
-----Oorspronkelijk bericht-----
Van: Paul Curtis [mailto:plc@plc@...] 
Verzonden: dinsdag 5 augustus 2003 12:12
Aan: msp430@msp4...
Onderwerp: RE: [msp430] placing data at a specific location in flash
 
Martijn,

Far be it from me to be an IAR support engineer, but I think in table.c,
as you've not #included table.h, the compiler doesn't know that the
table is constant when it compiles the .c file.

I think you'll need:

const tLITabl LayoutItemTbl[]= ...

That's an "I think".  You'll probably also need to use some
other pragma
than codeseg, I would guess, too, as it doesn't go in the code segment.

-- Paul.

> -----Original Message-----
> From: Martijn Broens [mailto:martijn@mart...] 
> Sent: 05 August 2003 09:38
> To: msp430@msp4...
> Subject: [msp430] placing data at a specific location in flash
> 
> 
> Hi all,
>  
> I've got a table that needs to be uploadable over a serial 
> port. But I don't know what the correct way is for me to 
> define the table in the files. I.e. the typedef and the enum 
> never change so should be in flash??, the table should be 
> uploadeble and therefore should remain in flash as well. But 
> for some reason the consume data space. Can anyone tell me 
> what it is that I'm overseeing??
>  
> /*--------- msp430F149C.xcl --*/
> //  Information memory (FLASH)
> -Z(CODE)INFOA00-107F
> -Z(CODE)INFOB80-10FF
> -Z(CODE)FLASHPAGEN00-11FF
> -Z(CODE) TABLECONTENT |00-7FFF
> -Z(CODE)UDATA00-FDFF
>  
> //  Main memory (FLASH) -Z(CODE)CODE,CONST,CSTR,CDATA0,CCSTR00-7BFF
>  
> /*--------- table.h --*/
> // this data never changes
> typedef enum e_resid{
>             resMainMenuButtonText= 1,
>             resMainMenuTitleText,
>             resReturnButton, 
>             resCaption,
> //          ....
> }e_resid;
>  
> typedef struct{
>    U8                 MaxLen;
>    e_resid          resNr;
>    U8*               Caption;
> } tLITabl;
>  
> extern   const tLITabl LayoutItemTbl[];
>  
> /*--------- table.c --*/
> // table needs to be uploadeble by usart port
> #pragma codeseg(TABLECONTENT)
> tLITabl LayoutItemTbl[]> {
>             {15, resMainMenuButtonText,    "Enter here."},
>             {0, resMainMenuTitleText,          "Mainmenu"},
>             {0, resReturnButton,                  "Return"},
>             {0, resCaption,                          ""},
> // .... And a lot more of these
> {0,0,0} // Last element from table!!!!!
> };
> #pragma memoryault
>  
> thanks,
> Martijn
>  
> 
> 
> 
> 
> 
> ------------------------ 
 
<http://rd.yahoo.com/M$5454.3656312.4921743.1261774/D=egroupweb/S05
005378:HM/A57554/R=0/SIGc6fnta2/*http:/ipunda.com/clk/beibunmaisui
yuiwabei> 

 
<http://us.adserver.yahoo.com/l?M$5454.3656312.4921743.1261774/D=egrou
pmail/S=:HM/A57554/randr2002580> 

.



">http://docs.yahoo.com/info/terms/>  Terms of Service.