Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Setting bytes in absolute address

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Setting bytes in absolute address
Moderator:
ANCY

Post Reply
Follow this topic



Setting bytes in absolute address

H L posted on 08 Nov 2011 8:40 PM PST
Top Contributor
679 Forum Posts

Hi,

I am using the psoc 5 with 256k flash for a project and need to set some locations of the flash to a pre-defined value during compile time.

i.e. I need to put 0xAA in adress 0x3ffff ( the last byte of the flash). This is for a signature checking for production process.

Any idea how to do it with the PSoC creator?

Thanks

Lawrence

 

 

 




Re: Setting bytes in absolute address

H L posted on 09 Nov 2011 03:51 AM PST
Top Contributor
679 Forum Posts

 Don't worry, I figured out how to do this..

 



Re: Setting bytes in absolute address

David Ron posted on 10 Nov 2011 10:24 PM PST
Top Contributor
24 Forum Posts

hey lleung

can you please share with us how u were able to do it?

i tried _at_ but in vain.

 



Re: Setting bytes in absolute address

H L posted on 10 Nov 2011 10:34 PM PST
Top Contributor
679 Forum Posts

Put this in the source file.

unsigned char ucCRCdata __attribute__ ((section (".CRCDATA"))) = 0xAA;

And go to the psoc creator

build setting -> linker -> command line

in the custom flags, add

-Wl,--section-start=.CRCDATA=0x30000

 

 

 

 



Re: Setting bytes in absolute address

H L posted on 10 Nov 2011 10:40 PM PST
Top Contributor
679 Forum Posts

Please also notice that you can not do this after 0x3fffc( or the last 4 byte of your chip). The compiler will fail.

I think that's because the ARM is 32 bit machine so the last address it can use is should be the last but 4.

 

 



Re: Setting bytes in absolute address

David Ron posted on 10 Nov 2011 10:50 PM PST
Top Contributor
24 Forum Posts

thank you very much for your quick reply.

i tried the same code in a sample project and tried to verify in debug mode. but i wasn't able to see the 0xAA at the location 0x30000. is it the right way to verify, or is there anything i am missing out?

thanks once again.



Re: Setting bytes in absolute address

H L posted on 10 Nov 2011 11:02 PM PST
Top Contributor
679 Forum Posts

you can check the memory data in the psoc creator after downloading the code to the chip.

you can also check the hex file, the content should be around line 3076



Re: Setting bytes in absolute address

H L posted on 10 Nov 2011 11:10 PM PST
Top Contributor
679 Forum Posts

One more thing is that the compiler would omit the code if it was not used.

In your code, you should use/refer to it at least once directly(not via a pointer).

 



Re: Setting bytes in absolute address

David Ron posted on 10 Nov 2011 12:38 AM PST
Top Contributor
24 Forum Posts

that's absolutely right lleung !

After using the variable in the code, i was able to see the required value in the specified memory location when i ran it in the debug mode.

 

thanks a lot !



Re: Setting bytes in absolute address

H L posted on 10 Nov 2011 03:29 AM PST
Top Contributor
679 Forum Posts

Good to hear that






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20