IAR configuration
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-27 1:38 PM
Posted on November 27, 2015 at 22:38
I am trying to perform a memory read operation in a STM32L152 discovery board using the following code:
#include ''stm32l1xx.h''#include ''stdio.h''uint16_t ts_cal1;uint32_t address1=0x1FF800FB;uint32_t address2=0x1FF800FE;ts_cal1 = *((uint16_t*)address1);I am getting several errors in the fourth lineError[Pe077]: this declaration has no storage class or type specifierError[Pe147]: declaration is incompatible with ''uint16_t ts_cal1'' (declared at line 4) Error[Pe028]: expression must have a constant value I am not sure whether this is an IAR configuration error or not. Any suggestions will be appreciated.
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-27 3:15 PM
Posted on November 28, 2015 at 00:15
Probably objecting to the ODD address?
And that the code is rather formless, don't think you can do assignments like that. #include ''stm32l1xx.h'' #include ''stdio.h'' uint32_t address1=0x1FF800FA; uint16_t ts_cal1 = *((uint16_t*)address1);
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-11-28 12:38 AM
Posted on November 28, 2015 at 09:38
void SRAM_ReadBuffer(uint16_t* pBuffer, uint32_t uwReadAddress, uint32_t uwBufferSize)
{
__IO uint32_t write_pointer = (uint32_t)uwReadAddress;
for (; uwBufferSize != 0; uwBufferSize--)
{
/* Read a half-word from the memory */
*pBuffer++ = *(__IO uint16_t*) (SRAM_BANK_ADDR + write_pointer);
/* Increment the address*/
write_pointer += 2;
}
This is example how to read from memory space, where that space represents external SRAM
