How to use __attribute__ set the fixed address to a fixed value

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to use __attribute__ set the fixed address to a fixed value

1,287件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mile on Wed Sep 17 23:37:15 MST 2014
My code is as follows:

const uint16_t wMainFlag __attribute__((at(0xFE00))) = 1754;

int main(void)
{
uint16_t  u16Value = 0;
uint16_t *pTest    = 0;
pTest              = 0xFE00;

u16Value           = *pTest;
}

but u16Value is not 1754 is 512,why?

How to use  __attribute__   set the fixed address(0xFE00) to a fixed value(1754)in LPCXpresso?

And My LPCXpresso version is :Version: LPCXpresso v5.2.4 [Build 2122] [2013-04-29]
0 件の賞賛
返信
1 返信

1,190件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Sep 18 00:25:09 MST 2014
'at' is not an attribute supported by GCC. For more information, please see:

http://www.lpcware.com/content/faq/lpcxpresso/problems-compiling-attribute-at
[or for LPCXpresso 5 - http://support.code-red-tech.com/CodeRedWiki/attribute_at ]

And for more general information on controlling the placement of your application code/data, please see:
http://www.lpcware.com/content/faq/lpcxpresso/own-linker-scripts
[or for LPCXpresso 5 - http://support.code-red-tech.com/CodeRedWiki/OwnLinkScripts ]

There is also quite a lot of information around on the web on this area, for example:

http://stackoverflow.com/questions/4067811/how-to-place-a-variable-at-a-given-absolute-address-in-me...
http://mcuoneclipse.com/2012/11/01/defining-variables-at-absolute-addresses-with-gcc/

Regards,
LPCXpresso Support


0 件の賞賛
返信