renode, "push" a button and "see" a LED lighting

1.2k views Asked by At

I'm running my first renode demo, stm32f4_discovery.resc. So far so good, I see an announcement from Contiki in sysbus.uart4 window and Ethernet packets in the terminal.

How can I "push" the UserButton and "see" if UserLED is on?

stm32f4_discovery.repl:

UserButton: Miscellaneous.Button @ gpioPortA
    -> gpioPortA@0

UserLED: Miscellaneous.LED @ gpioPortD

gpioPortD:
    12 -> gpioPortD@0

The closest example I found so far was I2C temperature.

Are sources of the demo-.elf available somewhere?
http://antmicro.com/projects/renode/stm32f4discovery.elf-s_445441-and.so.on...

1

There are 1 answers

0
Piotr Zierhoffer On BEST ANSWER

There was an issue with the STM32F4 Discovery platform description in Renode, which is now fixed on master.

To toggle a button you should use the Monitor CLI. To list all available methods:

(STM32F4_Discovery) gpioPortA.UserButton 
The following methods are available:
[...]
 - Void Press ()
 - Void PressAndRelease ()
 - Void Release ()
[...]
 - Void Toggle ()
[...]

You can use these to interact with the button:

(STM32F4_Discovery) gpioPortA.UserButton Toggle

The LED state will be changed, but it's not very easy to spot. You can either check the state manually:

(STM32F4_Discovery) gpioPortA.externalLed State 
False (or True)

You can also track accesses to the LED in the logger window. To enable that, run:

(STM32F4_Discovery) logLevel -1 gpioPortA.externalLed 
(STM32F4_Discovery) logLevel 3 # this is not required, but will hush other logs

Unfortunately, the sources are not available - it's a very old demo and we didn't track them as well back then.