2022-06-12 19:43:30 -04:00
|
|
|
Import('rtconfig')
|
|
|
|
from building import *
|
2023-01-29 03:11:20 -05:00
|
|
|
import os
|
2022-06-15 06:05:44 -04:00
|
|
|
import shutil
|
2022-06-12 19:43:30 -04:00
|
|
|
|
2022-08-08 19:25:39 -04:00
|
|
|
src = ['perf_counter.c', 'os/perf_os_patch_rt_thread.c']
|
2022-06-12 19:43:30 -04:00
|
|
|
cwd = GetCurrentDir()
|
|
|
|
path = [cwd]
|
2022-09-24 17:27:27 -04:00
|
|
|
CPPDEFINES = ['__PERF_COUNT_PLATFORM_SPECIFIC_HEADER__=<rtthread.h>', '__perf_counter_printf__=rt_kprintf', '__PERF_CNT_USE_RTOS__']
|
2022-06-12 19:43:30 -04:00
|
|
|
|
2022-06-15 06:05:44 -04:00
|
|
|
#delate unused files
|
|
|
|
try:
|
|
|
|
shutil.rmtree(os.path.join(cwd,'.github'))
|
|
|
|
shutil.rmtree(os.path.join(cwd,'.vscode'))
|
|
|
|
shutil.rmtree(os.path.join(cwd,'CI'))
|
|
|
|
shutil.rmtree(os.path.join(cwd,'cmsis-pack'))
|
|
|
|
shutil.rmtree(os.path.join(cwd,'lib'))
|
|
|
|
shutil.rmtree(os.path.join(cwd,'example'))
|
|
|
|
os.remove(os.path.join(cwd,'systick_wrapper_gcc.s'))
|
|
|
|
os.remove(os.path.join(cwd,'systick_wrapper_ual.s'))
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
2023-01-31 23:09:41 -05:00
|
|
|
CXXFLAGS = ''
|
|
|
|
|
|
|
|
if rtconfig.PLATFORM == 'armcc': # Keil AC5
|
|
|
|
CXXFLAGS += ' --gnu'
|
|
|
|
|
|
|
|
group = DefineGroup('perf_counter', src, depend = ['PKG_USING_PERF_COUNTER'], CPPDEFINES = CPPDEFINES, CPPPATH = path, CXXFLAGS = CXXFLAGS)
|
2022-06-12 19:43:30 -04:00
|
|
|
|
|
|
|
Return('group')
|