2323 views|0 replies

6841

Posts

11

Resources
The OP
 

[National Technology N32G430] 6. Porting FreeRtos [Copy link]

 

[Purpose] Port freertos to the N32G430 development board and implement a basic routine for LED flashing:

1. Create a blank folder to store the project. Create three folders under the folder: FreeRTOS, MDK, and User, which are used to store freertos system files, MDK project files, and user files respectively.

2. Copy the firmware folder provided by the manufacturer to the Template directory:

3. Create a new project under the MDK directory, and set the location of the header file after establishing relevant references as shown in the figure:

4. Create main.c


#include "main.h"
#include "bsp_led.h"
#include "cmsis_os.h"

void MX_FREERTOS_Init(void);

int main(void)
{

	LED_Initialize(LED1_GPIO_PORT, LED1_GPIO_PIN );

	osKernelInitialize();  /* Call init function for freertos objects (in freertos.c) */
	MX_FREERTOS_Init();
	osKernelStart();
	
	while(1)
	{
	}
}


osThreadId_t defaultTaskHandle;
const osThreadAttr_t defaultTask_attributes = {
  .name = "defaultTask",
  .stack_size = 128 * 4,
  .priority = (osPriority_t) osPriorityNormal,
};



void StartDefaultTask(void *argument);

void MX_FREERTOS_Init(void); 

void MX_FREERTOS_Init(void) {

  defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);

}


void StartDefaultTask(void *argument)
{
  for(;;)
  {
    osDelay(500);
    LED_Toggle(LED1_GPIO_PORT, LED1_GPIO_PIN);
  }
  
}

There are no errors in the compilation. After downloading to the development board, you can see that the PA1 light flashes regularly.

Template.7z (358.09 KB, downloads: 28)
This post is from Domestic Chip Exchange
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list