-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
152 lines (111 loc) · 7.21 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
project('meson_test', 'c',
version : '0.1',
default_options : ['warning_level=3']
)
[host_machine]
system = 'none'
cpu_family = 'arm'
cpu = 'cortex-m4'
endian = 'little'
#================================================================================================================================#
# check Creator_PostBuild version and set various variables for possible use
# Creator_PostBuild_Minumum_Version: '2.10' - used for checking Creator_PostBuild minimum version, do not remove
# Creator_PostBuild_Version_Line - automatic insert of Creator_PostBuild version. Do not edit the line below
# Creator_PostBuild_DateTime_Line - automatic insert of Creator Generated DateTime. Do not edit the line below
# Creator_PostBuild_devicePart_Line - automatic insert of device part by Creator_PostBuild. Do not edit the line below
# Creator_PostBuild_linkerFile_Line - automatic insert of linker file by Creator_PostBuild. Do not edit the line below
# Creator_PostBuild_SVDfile_Line - automatic insert of SVD file by Creator_PostBuild. Do not edit the line below
# Creator_PostBuild_prePostBuild_Lines - automatic insert of pre- and postbuild commands by Creator_PostBuild. Do not edit the two line below
# set directories
# Creator_PostBuild_Directory_Line - automatic insert of Creator Project main directory. Do not edit the line below
# OTX_Extension_print(PROJECTNAME = '${workspaceFolderBasename}')
PROJECTNAME = 'BLE-example'
# OTX_Extension_print(ONETHINX_PACK_LOC = '${env:ONETHINX_PACK_LOC}')
ONETHINX_PACK_LOC = '/Applications/OTX-Maestro'
CONFIG_DIR = ONETHINX_PACK_LOC + '/config'
GCC_DIR = ONETHINX_PACK_LOC + '/gcc-arm/bin'
BIN_DIR = ONETHINX_PACK_LOC + '/bin'
SCRIPTS_DIR = ONETHINX_PACK_LOC + '/config/scripts'
MESON_SOURCE_LOC = meson.current_source_dir()
CREATOR_DIR = MESON_SOURCE_LOC + '/' + creatorDirectory
#================================================================================================================================#
# import tools
objcopy = find_program(GCC_DIR + '/arm-none-eabi-objcopy').path()
objdump = find_program(GCC_DIR + '/arm-none-eabi-objdump').path()
size = find_program(GCC_DIR + '/arm-none-eabi-size').path()
gdb = find_program(GCC_DIR + '/arm-none-eabi-gdb').path()
cymcuelftool = find_program(BIN_DIR + '/cymcuelftool').path()
readelf = find_program(GCC_DIR + '/arm-none-eabi-readelf').path()
memcalc = find_program(BIN_DIR + '/memcalc').path()
#================================================================================================================================#
# setup compile & link arguments
assembler_args = [
# Creator_PostBuild_AssemblerOptions_Start - automatic insert of assembler options by Creator_PostBuild. Do not edit below this line
# Creator_PostBuild_AssemblerOptions_End - automatic insert of assembler options by Creator_PostBuild. Do not edit above this line
]
compiler_args = [
# Creator_PostBuild_CompilerOptions_Start - automatic insert of compiler options by Creator_PostBuild. Do not edit below this line
# Creator_PostBuild_CompilerOptions_End - automatic insert of compiler options by Creator_PostBuild. Do not edit above this line
'-O0'
]
linker_args = [
'-T'+SCRIPTS_DIR+'/linker/OnethinxCore_18.ld', # manual insert of OTX18 linkerfile
# Creator_PostBuild_LinkerOptions_Start - automatic insert of linker options by Creator_PostBuild. Do not edit below this line
# Creator_PostBuild_LinkerOptions_End - automatic insert of linker options by Creator_PostBuild. Do not edit above this line
]
include_dirs = [
# OTX_Extension_HeaderFiles_Start - automatic insert of source files by the OTX VSCode extension. Do not edit below this line
# OTX_Extension_HeaderFiles_End - automatic insert of source files by the OTX VSCode extension. Do not edit above this line
# Creator_PostBuild_IncludeFolders_Start - automatic insert of include header folders by Creator_PostBuild. Do not edit below this line
# Creator_PostBuild_IncludeFolders_End - automatic insert of include header folders by Creator_PostBuild. Do not edit above this line
]
sourcefiles = [
# manual insert of Creator_PostBuild stripped files
CREATOR_DIR + '/gcc/startup_psoc6_01_cm4.S',
CREATOR_DIR + '/system_psoc6_cm4.c',
CREATOR_DIR + '/Generated_Source/PSoC6/cyfitter_cfg_otx.c',
# OTX_Extension_SourceFiles_Start - automatic insert of source files by the OTX VSCode extension. Do not edit below this line
# OTX_Extension_SourceFiles_End - automatic insert of source files by the OTX VSCode extension. Do not edit above this line
# Creator_PostBuild_SourceFiles_Start - automatic insert of source files by Creator_PostBuild. Do not edit below this line
# Creator_PostBuild_SourceFiles_End - automatic insert of source files by Creator_PostBuild. Do not edit above this line
]
#================================================================================================================================#
# include libraries
cc = meson.get_compiler('c')
# example: include library.a from directory
#link_deps = declare_dependency( dependencies : cc.find_library('library', dirs : ['directory/libdir']) )
link_deps = [
# Creator_PostBuild_LibSources_Start - automatic insert of include source files by Creator_PostBuild. Do not edit below this line
# Creator_PostBuild_LibSources_End - automatic insert of include source files by Creator_PostBuild. Do not edit above this line
]
# example: include object.o from directory
#link_deps += declare_dependency( link_args : ['directory/libdir/object.o'] )
#================================================================================================================================#
# run prebuild script
#prebuild = custom_target('prebuild', output : 'buildversion.h', command : [MESON_SOURCE_LOC+'/config/prebuild.bash']) #use prebuild.bash / prebuild.bat file
#link_deps += declare_dependency( sources : [prebuild])
#================================================================================================================================#
# build executable
main = executable(
PROJECTNAME, [sourcefiles],
name_suffix : 'elf',
c_args : [compiler_args],
link_args : [linker_args],
dependencies : link_deps,
include_directories : [include_dirs] )
#================================================================================================================================#
# run post build
#uncomment for a signed build output
#signed = custom_target(
# PROJECTNAME + '_signed.elf',
# output : [PROJECTNAME + '_signed.elf'],
# build_by_default : true,
# command : [cymcuelftool, '--sign', PROJECTNAME + '.elf', '--output', PROJECTNAME + '_signed.elf', '--hex', PROJECTNAME + '.hex'],
# depends : [main])
mainout = custom_target(
PROJECTNAME + '.memcalc.txt',
output : [PROJECTNAME + '.memcalc.txt'],
build_by_default : true,
console : true,
command : [memcalc, readelf, PROJECTNAME + '.elf', '0x0e0000', '0x38000', '0x10000000', '0x08000000', PROJECTNAME + '.memcalc.txt'], #Flash 0x0e0000 SRAM 0x38000 Flash start 0x10000000 SRAM start 0x08000000
depends : [main])