Skip to main content
Visitor II
March 27, 2020
Question

Using ST Visual Developer with Cosmic-C compiler. Why do I keep getting "Invalid indirection operand" when creating a pointer?

  • March 27, 2020
  • 1 reply
  • 1014 views

I'm using ST Visual Developer with Cosmic-C compiler.

Writing code for STM8S903K3.

Making a pointer to get the value from a SPR register, ADC_DRH:

uint8_t *pv;

pv = *0x005404;

I keep getting the errors;

#error cpstm8 main.c:85(8+8) invalid indirection operand

#error cpstm8 main.c:86(1+7) misplaced local declaration

Don't know what I'm doing wrong.

    This topic has been closed for replies.

    1 reply

    Explorer
    March 28, 2020

    STVD hasn't provided the register definitions? Code'll never be pretty if you're poking memory like this. But if you insist...

     volatile uint8_t *pv = (uint8_t *)0x005404;
     *pv = <whatever you want to write>;