2023-10-31 09:45 AM - last edited on 2024-07-08 06:45 AM by Peter BENSCH
Hi
Im using a STM32MP157-DK2 with a OpenSTlinux. I load my .elf file of for the M4 to /lib/firmware/ and starts it by chaning the state to start in remoteproc. The problem I have is that remoteproc seems to not run the code from the beginning of the main function. I have added some GPIO debugging outputs to see if they are activated but not all of them are activated. The code seems however to be work fine and the UARTs and ADC etc that are initialized and do work. So they are obviously initialized correctly... If I then stops the process by sending stop to remoteproc and then re-starts by sending start, all debug outputs are activated. Meaning that the program restarts from the beginning of main.
In the below example, the GPIO will not toggle at first start, but it toggle during the second start.
int main(void)
{
/* USER CODE BEGIN 1 */
//HAL_Init();
MX_ADC1_Init();
MX_ADC2_Init();
HAL_DeInit();
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
__HAL_RCC_HSEM_CLK_ENABLE();
/* USER CODE END Init */
if(IS_ENGINEERING_BOOT_MODE())
{
/* Configure the system clock */
SystemClock_Config();
}
if(IS_ENGINEERING_BOOT_MODE())
{
/* Configure the peripherals common clocks */
PeriphCommonClock_Config();
}
else
{
/* IPCC initialisation */
MX_IPCC_Init();
/* OpenAmp initialisation ---------------------------------*/
MX_OPENAMP_Init(RPMSG_REMOTE, NULL);
}
/* USER CODE BEGIN SysInit */
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
int i = 0;
HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_15);
i = 0;
while(i++ < 1000);
HAL_GPIO_TogglePin(GPIOD, GPIO_PIN_15);
i = 0;
MX_DMA_Init();
MX_ADC1_Init();
MX_ADC2_Init();
MX_TIM12_Init();
MX_TIM16_Init();
MX_UART7_Init();
MX_TIM1_Init();
MX_TIM4_Init();
MX_TIM8_Init();
MX_USART6_UART_Init();
Anybody that knows about how remoteproc works and why it is like this?