In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
The main content of this article is to explain "what is the method of porting AWTK on TOS". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the method of transplanting AWTK on TOS?"
1. Add documents related to TOS.
AWTK has been ported to the STM32f103ze bare system, and TOS support is added directly on top of awtk-stm32f103ze-raw for simplicity.
Add the following files to Keil:
TencentOS/kernel/core/tos_event.cTencentOS/kernel/core/tos_fifo.cTencentOS/kernel/core/tos_global.cTencentOS/kernel/core/tos_mmblk.cTencentOS/kernel/core/tos_mmheap.cTencentOS/kernel/core/tos_msg.cTencentOS/kernel/core/tos_mutex.cTencentOS/kernel/core/tos_pend.cTencentOS/kernel/core/tos_queue.cTencentOS/kernel/core/tos_robin.cTencentOS/kernel/core/tos_sched.cTencentOS/kernel/core/tos_sem. CTencentOS/kernel/core/tos_sys.cTencentOS/kernel/core/tos_task.cTencentOS/kernel/core/tos_tick.cTencentOS/kernel/core/tos_time.cTencentOS/kernel/core/tos_timer.cTencentOS/kernel/pm/tos_pm.cTencentOS/kernel/pm/tos_tickless.cTencentOS/arch/arm/arm-v7m/common/tos_cpu.cTencentOS/arch/arm/arm-v7m/common/tos_fault.cTencentOS/arch/arm/arm-v7m/cortex-m3/armcc/port_ C.cTencentOS/arch/arm/arm-v7m/cortex-m3/armcc/port_s.S
Increase the path of include
TencentOS/arch/arm/arm-v7m/common/includeTencentOS/arch/arm/arm-v7m/cortex-m3/armccTencentOS/kernel/core/includeTencentOS/kernel/hal/includeTencentOS/kernel/pm/includeTencentOS/TOS-CONFIG
Modify the configuration file
Modify the configuration TencentOS/TOS-CONFIG/tos_config.h according to your own needs:
Generally speaking, it does not need to be modified, just use what is provided by the government. I used it from the TencentOS-Demo project.
two。 Add functions for threads and synchronization implemented by TOS. Src/platforms/tos/mutex.csrc/platforms/tos/semaphore.csrc/platforms/tos/thread.csrc/platforms/common/sys_tick.c3. Implement rtos.c
It is mainly the implementation of SysTick interrupt, which can be copied from TencentOS-Demo.
Ret_t rtos_init (void) {tos_knl_init (); tos_robin_config (TOS_ROBIN_STATE_ENABLED, (k_timeslice_t) 500U); return RET_OK;} ret_t rtos_start (void) {tos_knl_start (); return RET_OK;} void rtos_tick (void) {if (tos_knl_is_running ()) {tos_knl_irq_enter (); tos_tick_handler () Tos_knl_irq_leave ();} void rtos_delay (uint32_t ms) {tos_task_delay (ms);} 4. Start AWTKvoid* awtk_thread (void* args) {gui_app_start (320,480); return NULL;} static ret_t awtk_start_ui_thread (void) {tk_thread_t* ui_thread = tk_thread_create (awtk_thread, NULL); return_value_if_fail (ui_thread! = NULL, RET_BAD_PARAMS); tk_thread_set_priority (ui_thread, 3) in the thread Tk_thread_set_name (ui_thread, "awtk"); tk_thread_set_stack_size (ui_thread, 2048); return tk_thread_start (ui_thread);} int main () {hardware_prepare (); platform_prepare (); rtos_init (); awtk_start_ui_thread (); rtos_start (); return 0;}
There are two main differences between this and the naked system:
Start AWTK in a thread.
If you want to call platform_prepare,platform_prepare in advance to initialize memory, it is a bit late to put it in tk_init and need to call it separately.
For this reason, the platform_prepare function is handled to prevent repeated calls.
Static bool_t s_inited = FALSE;static uint32_t s_heam_mem [4096]; ret_t platform_prepare (void) {if (! s_inited) {s_inited = TRUE; tk_mem_init (s_heam_mem, sizeof (s_heam_mem));} return RET_OK;}
Integrating RTOS with AWTK is very simple, and the above process took about 2 hours. As long as RTOS itself is portable, integrating AWTK and RTOS is a matter of minutes.
At this point, I believe you have a deeper understanding of "what is the method of transplanting AWTK on TOS". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
Rely on org.springframework.boot spring-boot-starter-data-jpa
© 2024 shulou.com SLNews company. All rights reserved.