Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).
|
How can I create a label at an absolute location? I have some legacy code for another CPU that expects an ASM file to org to a location and declare a symbol: org 1234 _symbol DW ? ; declare a word at this location public _symbol The symbol represents a logical location of a parameter in non-volatile storage. Elsewhere, C code uses this symbol with extern dword symbol; value = get_nonvolatile(&symbol); How might I accomplish this with the SHARC tools? The ASM file uses conditional compilation to control the layout of storage, so I can't simply change the C files or declare the symbols in headers. Kenneth Porter Kensington Laboratories, Inc. mailto: http://www.kensingtonlabs.com |
|
|
|
hello, On Wed, 18 Aug 1999, Kenneth Porter wrote: > How can I create a label at an absolute location? I have some legacy > code for another CPU that expects an ASM file to org to a location and > declare a symbol: > > org 1234 > _symbol DW ? ; declare a word at this location > public _symbol > Elsewhere, C code uses this symbol with > > extern dword symbol; > value = get_nonvolatile(&symbol); > How might I accomplish this with the SHARC tools? > > The ASM file uses conditional compilation to control the layout of > storage, so I can't simply change the C files or declare the symbols in > headers. if you conditionally include the headers ? nevertheless, i am not sure if i get it completely, but the following might help: for absolute placement of variables you can declare a separate segment in the architecture file (linker description file) and place the variable within this segment. for conditional compilation this does not help, of course. furthermore you can read/write absolutely from/to memory: value = *((unsigned*) _absolute_adress_ ); // read *((unsigned*) _absolute_adress_ ) = value; // write when you conditionally define the value of _absolute_adress_, then it could do what you need. but take care where you read/write from/to the memory at _absolute_adress_. it needs not to be declared in the architecture file. you can manipulate all existent (and nonexistent) memory with the above lines (your IOP regs as well). Michael -- Michael Haertl |
|
|
|
On Thu, 19 Aug 1999 12:04:06 +0200 (MET DST), Michael Haertl wrote: > if you conditionally include the headers ? Alas, the conditionals used with the client routines don't match those used with the declarations for the storage layout. Legacy code, you know. > for absolute placement of variables you can declare a separate segment in > the architecture file (linker description file) and place the variable > within this segment. for conditional compilation this does not help, of > course. I thought I might be able to use the Port stuff in the LDF, but I haven't found an example, so I'm not sure if that does what I want. I'm figuring on using the C preprocessor to expand conditionals in my existing file and create LDF Port declarations that can be included in the main LDF file. > furthermore you can read/write absolutely from/to memory: > value = *((unsigned*) _absolute_adress_ ); // read > *((unsigned*) _absolute_adress_ ) = value; // write Today, that's how I'd write it. Hindsight is wonderful, isn't it? ;-) Kenneth Porter Kensington Laboratories, Inc. mailto: http://www.kensingtonlabs.com |