Skip to main content
adrazer1980
Visitor II
November 27, 2015
Question

IAR configuration

  • November 27, 2015
  • 2 replies
  • 1004 views
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 line

Error[Pe077]: this declaration has no storage class or type specifier

Error[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 topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    November 27, 2015
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    megahercas6
    Associate III
    November 28, 2015
    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