Minimum spatial reference required for STM32 UCOS

Publisher:悦耳旋律Latest update time:2017-02-16 Source: eefocusKeywords:STM32  UCOS Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Using STM32 to run UCOS, I wrote a very simple program and compiled it as follows

Program Size: Code=24562 RO-data=746 RW-data=88 ZI-data=7456 

Based on this calculation, if the FLASH is less than 24K and the RAM is less than 8K, then the UCOS of STM32 cannot be considered at all, and it can only be run bare.

The FLASH of STM32 is relatively satisfactory, generally 64K, mainly RAM. It seems that there is not much hope for STM32F0XX STM32F100

----------------------The following is main.c-----------------------


#define MAIN_C
#include "includes.h"

 
                  
void first_task(void *pdata);
void task_2(void *pdata);
void task_3(void *pdata);


 
int main()
{
 RCC_ClocksTypeDef OS_Clocks;
 bsp_Ini(); //Initialize each driver, put in bsp_ini.c
 OSInit(); //ucos system initialization  
 RCC_GetClocksFreq(&OS_Clocks);     
 OS_CPU_SysTickInit( OS_Clocks.HCLK_Frequency / OS_TICKS_PER_SEC ); //Set clock tick, 1ms
 OSTaskCreate(first_task,0,&stk1[99],task1_sn); //Create the first task
 OSStart(); //Task start
}

void first_task(void *pdata) //Create other tasks in the first task (official recommendation)
{
 INT8U err;
 int AD_value;
 pdata=pdata;

 flag1=OSFlagCreate(0,&err);      
 OSTaskCreate(task_2,0,&stk2[99],task2_sn);
 OSTaskCreate(task_3,0,&stk3[99],task3_sn);

   
 while(1)         
 { 
  AD_value=(int) ( (double) ADC_GetConversionValue(ADC1) *3/4096 * 100 ) ;
  DEBUG_COM_STREAM("\r\nAD=%L",(u8*)&AD_value);//USART_SendData(USART1, test);
  OSTimeDly(1000);
 }
}

void task_2(void *pdata) //Create other tasks in the first task (official recommendation)
{
 INT8U err1;
 char test;
 pdata=pdata;
 while(1)         
 {
  OSFlagPend(flag1,EVENT_1,OS_FLAG_WAIT_SET_ALL+OS_FLAG_CONSUME,0,&err1);
  test = (char)USART_Date;
  DEBUG_COM_STREAM("\r\nReceived:%c",(u8*)&test);//USART_SendData(USART1, test);
  DAC_SetChannel1Data(DAC_Align_12b_R, test*16);
 }
}


u8 count;
void task_3(void *pdata) //Create other tasks in the first task (official recommendation)
{
 pdata=pdata;
 GPIO_INITIAL();
 EXTI_INITIAL(ENABLE);
 while(1)         
 {  
  OSTimeDly(1000);
  count++;  
  if(count==3000)
   {PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
   RCC_Ini();//bsp_Ini();
   count=0;
   }
  else if(wake_id!=0)
   {DEBUG_COM_STREAM("wake_id=%x",(u8*)&wake_id);
   wake_id=0;
   }
  DEBUG_COM_STREAM(" I am task 3=%x",&count);
 }
}


Keywords:STM32  UCOS Reference address:Minimum spatial reference required for STM32 UCOS

Previous article:STM32 HSE LSE crystal oscillator official recommendation
Next article:Finally, I can summarize the STM32 low power consumption

Recommended ReadingLatest update time:2024-11-16 13:55

STM32 timer triggers ADC
Take the regular channel of STM32 ADC as an example (the injection channel is similar): As shown in the figure, the regular channel of STM32 ADC can be triggered by any of the above 6 signals. We use TIM2_CH2 to trigger ADC1, independent mode, and only measure one channel at a time. The configuration of ADC is as fo
[Microcontroller]
STM32 timer triggers ADC
STM32 learning exploration: the realization of running lights
Implementation of Flowing Lights Here we use the stm32mini development board to realize the external water lamp. Here I use three lamps (just explain the problem). The external pins are PA2, PB8, and PC13. When connecting, the positive pole of the lamp is connected to the GPIO pin, and the negative pole is connected t
[Microcontroller]
STM32 learning exploration: the realization of running lights
STM32 MCU (13) I2C reading and writing AT24Cxx memory experiment
This program mainly uses the I2C serial bus to realize the reading and writing of AT24Cxx series EEPROM memory (here is AT24C02), writes data, and then reads it out and sends it to the serial port The property of EEPROM memory that data does not disappear when power is off can be used to store some configuration data,
[Microcontroller]
How to use STM32 configuration to generate PWM
It is very convenient for STM32 to generate PWM. You only need to set the timer to generate it immediately! Of course, simple settings are also troublesome for novices, mainly including: (1) Enable the timer clock: RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); (2) Define the corresponding GPIO: /* PA2,3
[Microcontroller]
STM32 serial port DMA routine
[Microcontroller]
STM32 serial port DMA routine
STM32 Note 14: Basic issues, let's discuss the software architecture
Everyone is discussing and learning online, but few people discuss the basic issue of architecture. I personally think that a good architecture is the basis for writing good code, which can make the later debugging work more efficient! ! 1.            Architecture composition: My program code is divided into four st
[Microcontroller]
Design of touch screen for battery management system based on STM32 microcontroller
0 Introduction Electric vehicles have always been a focus of attention for their cleanliness and environmental protection. With the intensification of the energy crisis and the continuous rise in oil prices, electric vehicles are becoming more and more popular among users. Electric vehicles are generally powered by
[Microcontroller]
Design of touch screen for battery management system based on STM32 microcontroller
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号