Binary (or STK3700 repl) file doesn't work properly in Renode project

17 views Asked by At

I ran some straightforward code for setting an LED in Simplicity Studio, then loaded the binary file into Renode, however, whenever I try to read the status of the LED in question, it returns false, even though it should be on and returning true.

The GPIO ports in the repl file are set according to the documentation.

I'm not sure what's wrong. The code should be good, I have tested it on hardware, maybe it's the STK3700 repl files that are at fault? I got them off of this GitHub link:

https://github.com/renode/renode/blob/master/platforms/boards/silabs/stk3700.repl

The code that sets LED0 (again, this is tested, just posting it in case it's needed):

#include <stdint.h>
#include "em_device.h"
#include "em_chip.h"
#include "em_cmu.h"
#include "em_gpio.h"

int main(void)
{
  /* Chip errata */
  CHIP_Init();

CMU_ClockEnable(cmuClock_GPIO,1);

  /* Infinite loop */
  while (1) {

      GPIO_PinModeSet(gpioPortE,2, gpioModePushPull, 1);
  }
}

Here is the Renode process I used for testing, that should be returning true:

Renode, version 1.14.0.34213 (81da46c1-202308081855)

(monitor) mach create "test"
(test) machine LoadPlatformDescription @platforms/boards/silabs/stk3700.repl 
(test) sysbus LoadBinary @C:/code/renode_test.bin 0x000
(test) start
Starting emulation...
(test) sysbus.gpioPort.led0 State
False

I've tried other test methods, but regardless of the code I write I don't get the desired output.

1

There are 1 answers

0
Clifford On

GPIO_PinModeSet configures a GPIO pin, and need only be done once, before the loop. You have no GPIO_PinOutSet, GPIO_PinOutClear or GPIO_PinOutToggle to actually assert the pin state.

Whether that would light the LED or not on real hardware would depend on how the LED is connected, and the initial state of the output. Inverted logic is common; low for on.

It is always a good idea to use a blinking LED as an "alive" indication, a static state proves nothing, other than you have power.