Skip to content

Commit 1355c29

Browse files
committed
Add PROS
1 parent 40cd531 commit 1355c29

File tree

138 files changed

+12627
-16757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+12627
-16757
lines changed

.gitignore

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,17 @@
1-
bin/
1+
# Compiled Object files
22
*.o
3-
program
4-
*.dblite
3+
*.obj
4+
5+
# Executables
6+
*.bin
7+
*.elf
8+
9+
# PROS
10+
bin/
511
.vscode/
6-
okapilib-template.zip
7-
.clang/
8-
*.gch
12+
.cache/
913
compile_commands.json
10-
cquery_log.txt
11-
okapilib@*.zip
12-
.DS_store
13-
.cproject
14-
.idea/
15-
.project
16-
.settings/
17-
cmake-build-debug/
18-
html/
19-
latex/
20-
xml/
21-
venv/
22-
*.d/
23-
build/
24-
src/squiggles/
25-
include/okapi/squiggles/
26-
verify-template/
14+
temp.log
15+
temp.errors
16+
*.ini
17+
.d/

common.mk

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,27 @@ ARCHTUPLE=arm-none-eabi-
22
DEVICE=VEX EDR V5
33

44
MFLAGS=-mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=softfp -Os -g
5-
CPPFLAGS=-D_POSIX_THREADS -D_UNIX98_THREAD_MUTEX_ATTRIBUTES
5+
CPPFLAGS=-D_POSIX_THREADS -D_UNIX98_THREAD_MUTEX_ATTRIBUTES -D_POSIX_TIMERS -D_POSIX_MONOTONIC_CLOCK
66
GCCFLAGS=-ffunction-sections -fdata-sections -fdiagnostics-color -funwind-tables
77

8+
# Check if the llemu files in libvgl exist. If they do, define macros that the
9+
# llemu headers in the kernel repo can use to conditionally include the libvgl
10+
# versions
11+
ifneq (,$(wildcard ./include/liblvgl/llemu.h))
12+
CPPFLAGS += -D_PROS_INCLUDE_LIBLVGL_LLEMU_H
13+
endif
14+
ifneq (,$(wildcard ./include/liblvgl/llemu.hpp))
15+
CPPFLAGS += -D_PROS_INCLUDE_LIBLVGL_LLEMU_HPP
16+
endif
17+
818
WARNFLAGS+=-Wno-psabi
919

1020
SPACE := $() $()
1121
COMMA := ,
1222

23+
C_STANDARD?=gnu11
24+
CXX_STANDARD?=gnu++2a
25+
1326
DEPDIR := .d
1427
$(shell mkdir -p $(DEPDIR))
1528
DEPFLAGS = -MT $$@ -MMD -MP -MF $(DEPDIR)/$$*.Td
@@ -24,8 +37,8 @@ wlprefix=-Wl,$(subst $(SPACE),$(COMMA),$1)
2437
LNK_FLAGS=--gc-sections --start-group $(strip $(LIBRARIES)) -lgcc -lstdc++ --end-group -T$(FWDIR)/v5-common.ld
2538

2639
ASMFLAGS=$(MFLAGS) $(WARNFLAGS)
27-
CFLAGS=$(MFLAGS) $(CPPFLAGS) $(WARNFLAGS) $(GCCFLAGS) --std=gnu11
28-
CXXFLAGS=$(MFLAGS) $(CPPFLAGS) $(WARNFLAGS) $(GCCFLAGS) --std=gnu++17
40+
CFLAGS=$(MFLAGS) $(CPPFLAGS) $(WARNFLAGS) $(GCCFLAGS) --std=$(C_STANDARD)
41+
CXXFLAGS=$(MFLAGS) $(CPPFLAGS) $(WARNFLAGS) $(GCCFLAGS) --std=$(CXX_STANDARD)
2942
LDFLAGS=$(MFLAGS) $(WARNFLAGS) -nostdlib $(GCCFLAGS)
3043
SIZEFLAGS=-d --common
3144
NUMFMTFLAGS=--to=iec --format %.2f --suffix=B
@@ -201,7 +214,7 @@ library: $(LIBAR)
201214

202215
.PHONY: template
203216
template: clean-template $(LIBAR)
204-
$Dprosv5 c create-template . $(LIBNAME) $(VERSION) $(foreach file,$(TEMPLATE_FILES) $(LIBAR),--system "$(file)") --target v5 $(CREATE_TEMPLATE_FLAGS)
217+
$Dpros c create-template . $(LIBNAME) $(VERSION) $(foreach file,$(TEMPLATE_FILES) $(LIBAR),--system "$(file)") --target v5 $(CREATE_TEMPLATE_FLAGS)
205218
endif
206219

207220
# if project is a library source, compile the archive and link output.elf against the archive rather than source objects
@@ -227,7 +240,7 @@ $(COLD_BIN): $(COLD_ELF)
227240
$(COLD_ELF): $(COLD_LIBRARIES)
228241
$(VV)mkdir -p $(dir $@)
229242
$(call test_output_2,Creating cold package with $(ARCHIVE_TEXT_LIST) ,$(LD) $(LDFLAGS) $(call wlprefix,--gc-keep-exported --whole-archive $^ -lstdc++ --no-whole-archive) $(call wlprefix,-T$(FWDIR)/v5.ld $(LNK_FLAGS) -o $@),$(OK_STRING))
230-
$(call test_output_2,Stripping cold package ,$(OBJCOPY) --strip-symbol=install_hot_table --strip-symbol=__libc_init_array --strip-symbol=_PROS_COMPILE_DIRECTORY --strip-symbol=_PROS_COMPILE_TIMESTAMP $@ $@, $(DONE_STRING))
243+
$(call test_output_2,Stripping cold package ,$(OBJCOPY) --strip-symbol=install_hot_table --strip-symbol=__libc_init_array --strip-symbol=_PROS_COMPILE_DIRECTORY --strip-symbol=_PROS_COMPILE_TIMESTAMP --strip-symbol=_PROS_COMPILE_TIMESTAMP_INT $@ $@, $(DONE_STRING))
231244
@echo Section sizes:
232245
-$(VV)$(SIZETOOL) $(SIZEFLAGS) $@ $(SIZES_SED) $(SIZES_NUMFMT)
233246

@@ -236,7 +249,7 @@ $(HOT_BIN): $(HOT_ELF) $(COLD_BIN)
236249

237250
$(HOT_ELF): $(COLD_ELF) $(ELF_DEPS)
238251
$(call _pros_ld_timestamp)
239-
$(call test_output_2,Linking hot project with $(COLD_ELF) and $(ARCHIVE_TEXT_LIST) ,$(LD) $(LDFLAGS) $(call wlprefix,-nostartfiles -R $<) $(filter-out $<,$^) $(LDTIMEOBJ) $(LIBRARIES) $(call wlprefix,-T$(FWDIR)/v5-hot.ld $(LNK_FLAGS) -o $@),$(OK_STRING))
252+
$(call test_output_2,Linking hot project with $(COLD_ELF) and $(ARCHIVE_TEXT_LIST) ,$(LD) -nostartfiles $(LDFLAGS) $(call wlprefix,-R $<) $(filter-out $<,$^) $(LDTIMEOBJ) $(LIBRARIES) $(call wlprefix,-T$(FWDIR)/v5-hot.ld $(LNK_FLAGS) -o $@),$(OK_STRING))
240253
@printf "%s\n" "Section sizes:"
241254
-$(VV)$(SIZETOOL) $(SIZEFLAGS) $@ $(SIZES_SED) $(SIZES_NUMFMT)
242255

@@ -272,7 +285,15 @@ $(VV)mkdir -p $(dir $(LDTIMEOBJ))
272285
@# Pipe a line of code defining _PROS_COMPILE_TOOLSTAMP and _PROS_COMPILE_DIRECTORY into GCC,
273286
@# which allows compilation from stdin. We define _PROS_COMPILE_DIRECTORY using a command line-defined macro
274287
@# which is the pwd | tail bit, which will truncate the path to the last 23 characters
275-
$(call test_output_2,Adding timestamp ,echo 'char const * const _PROS_COMPILE_TIMESTAMP = __DATE__ " " __TIME__; char const * const _PROS_COMPILE_DIRECTORY = "$(shell pwd | tail -c 23)";' | $(CC) -c -x c $(CFLAGS) $(EXTRA_CFLAGS) -o $(LDTIMEOBJ) -,$(OK_STRING))
288+
@#
289+
@# const int _PROS_COMPILE_TIMESTAMP_INT = $(( $(date +%s) - $(date +%z) * 3600 ))
290+
@# char const * const _PROS_COMPILE_TIEMSTAMP = __DATE__ " " __TIME__
291+
@# char const * const _PROS_COMPILE_DIRECTORY = "$(shell pwd | tail -c 23)";
292+
@#
293+
@# The shell command $$(($$(date +%s)+($$(date +%-z)/100*3600))) fetches the current
294+
@# unix timestamp, and then adds the UTC timezone offset to account for time zones.
295+
296+
$(call test_output_2,Adding timestamp ,echo 'const int _PROS_COMPILE_TIMESTAMP_INT = $(shell echo $$(($$(date +%s)+($$(date +%-z)/100*3600)))); char const * const _PROS_COMPILE_TIMESTAMP = __DATE__ " " __TIME__; char const * const _PROS_COMPILE_DIRECTORY = "$(wildcard $(shell pwd | tail -c 23))";' | $(CC) -c -x c $(CFLAGS) $(EXTRA_CFLAGS) -o $(LDTIMEOBJ) -,$(OK_STRING))
276297
endef
277298

278299
# these rules are for build-compile-commands, which just print out sysroot information

firmware/libpros.a

-922 KB
Binary file not shown.

firmware/v5-common.ld

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,52 @@ SECTIONS
2121
*(.gnu.linkonce.t.*)
2222
*(.plt)
2323
*(.gnu_warning)
24-
*(.gcc_execpt_table)
24+
*(.gcc_except_table)
2525
*(.glue_7)
2626
*(.glue_7t)
2727
*(.vfp11_veneer)
2828
*(.ARM.extab)
2929
*(.gnu.linkonce.armextab.*)
30-
} > MEMORY
30+
} > RAM
3131

3232
.init : {
3333
KEEP (*(.init))
34-
} > MEMORY
34+
} > RAM
3535

3636
.fini : {
3737
KEEP (*(.fini))
38-
} > MEMORY
38+
} > RAM
3939

4040
.rodata : {
4141
__rodata_start = .;
4242
*(.rodata)
4343
*(.rodata.*)
4444
*(.gnu.linkonce.r.*)
4545
__rodata_end = .;
46-
} > MEMORY
46+
} > RAM
4747

4848
.rodata1 : {
4949
__rodata1_start = .;
5050
*(.rodata1)
5151
*(.rodata1.*)
5252
__rodata1_end = .;
53-
} > MEMORY
53+
} > RAM
5454

5555
.sdata2 : {
5656
__sdata2_start = .;
5757
*(.sdata2)
5858
*(.sdata2.*)
5959
*(.gnu.linkonce.s2.*)
6060
__sdata2_end = .;
61-
} > MEMORY
61+
} > RAM
6262

6363
.sbss2 : {
6464
__sbss2_start = .;
6565
*(.sbss2)
6666
*(.sbss2.*)
6767
*(.gnu.linkonce.sb2.*)
6868
__sbss2_end = .;
69-
} > MEMORY
69+
} > RAM
7070

7171
.data : {
7272
__data_start = .;
@@ -77,18 +77,18 @@ SECTIONS
7777
*(.got)
7878
*(.got.plt)
7979
__data_end = .;
80-
} > MEMORY
80+
} > RAM
8181

8282
.data1 : {
8383
__data1_start = .;
8484
*(.data1)
8585
*(.data1.*)
8686
__data1_end = .;
87-
} > MEMORY
87+
} > RAM
8888

8989
.got : {
9090
*(.got)
91-
} > MEMORY
91+
} > RAM
9292

9393
.ctors : {
9494
__CTOR_LIST__ = .;
@@ -99,7 +99,7 @@ SECTIONS
9999
KEEP (*(.ctors))
100100
__CTOR_END__ = .;
101101
___CTORS_END___ = .;
102-
} > MEMORY
102+
} > RAM
103103

104104
.dtors : {
105105
__DTOR_LIST__ = .;
@@ -110,99 +110,99 @@ SECTIONS
110110
KEEP (*(.dtors))
111111
__DTOR_END__ = .;
112112
___DTORS_END___ = .;
113-
} > MEMORY
113+
} > RAM
114114

115115
.fixup : {
116116
__fixup_start = .;
117117
*(.fixup)
118118
__fixup_end = .;
119-
} > MEMORY
119+
} > RAM
120120

121121
.eh_frame : {
122122
*(.eh_frame)
123-
} > MEMORY
123+
} > RAM
124124

125125
.eh_framehdr : {
126126
__eh_framehdr_start = .;
127127
*(.eh_framehdr)
128128
__eh_framehdr_end = .;
129-
} > MEMORY
129+
} > RAM
130130

131131
.gcc_except_table : {
132132
*(.gcc_except_table)
133-
} > MEMORY
133+
} > RAM
134134

135135
.mmu_tbl (ALIGN(16384)) : {
136136
__mmu_tbl_start = .;
137137
*(.mmu_tbl)
138138
__mmu_tbl_end = .;
139-
} > MEMORY
139+
} > RAM
140140

141141
.ARM.exidx : {
142142
__exidx_start = .;
143143
*(.ARM.exidx*)
144144
*(.gnu.linkonce.armexidix.*.*)
145145
__exidx_end = .;
146-
} > MEMORY
146+
} > RAM
147147

148148
.preinit_array : {
149149
__preinit_array_start = .;
150150
KEEP (*(SORT(.preinit_array.*)))
151151
KEEP (*(.preinit_array))
152152
__preinit_array_end = .;
153-
} > MEMORY
153+
} > RAM
154154

155155
.init_array : {
156156
__init_array_start = .;
157157
KEEP (*(SORT(.init_array.*)))
158158
KEEP (*(.init_array))
159159
__init_array_end = .;
160-
} > MEMORY
160+
} > RAM
161161

162162
.fini_array : {
163163
__fini_array_start = .;
164164
KEEP (*(SORT(.fini_array.*)))
165165
KEEP (*(.fini_array))
166166
__fini_array_end = .;
167-
} > MEMORY
167+
} > RAM
168168

169169
.ARM.attributes : {
170170
__ARM.attributes_start = .;
171171
*(.ARM.attributes)
172172
__ARM.attributes_end = .;
173-
} > MEMORY
173+
} > RAM
174174

175175
.sdata : {
176176
__sdata_start = .;
177177
*(.sdata)
178178
*(.sdata.*)
179179
*(.gnu.linkonce.s.*)
180180
__sdata_end = .;
181-
} > MEMORY
181+
} > RAM
182182

183183
.sbss (NOLOAD) : {
184184
__sbss_start = .;
185185
*(.sbss)
186186
*(.sbss.*)
187187
*(.gnu.linkonce.sb.*)
188188
__sbss_end = .;
189-
} > MEMORY
189+
} > RAM
190190

191191
.tdata : {
192192
__tdata_start = .;
193193
*(.tdata)
194194
*(.tdata.*)
195195
*(.gnu.linkonce.td.*)
196196
__tdata_end = .;
197-
} > MEMORY
197+
} > RAM
198198

199199
.tbss : {
200200
__tbss_start = .;
201201
*(.tbss)
202202
*(.tbss.*)
203203
*(.gnu.linkonce.tb.*)
204204
__tbss_end = .;
205-
} > MEMORY
205+
} > RAM
206206

207207
.bss (NOLOAD) : {
208208
__bss_start = .;
@@ -211,7 +211,7 @@ SECTIONS
211211
*(.gnu.linkonce.b.*)
212212
*(COMMON)
213213
__bss_end = .;
214-
} > MEMORY
214+
} > RAM
215215

216216
_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
217217

firmware/v5-hot.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ MEMORY
2828
HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */
2929
}
3030

31-
REGION_ALIAS("MEMORY", HOT_MEMORY);
31+
REGION_ALIAS("RAM", HOT_MEMORY);
3232

3333
ENTRY(install_hot_table)

firmware/v5.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ MEMORY
2828
HOT_MEMORY : ORIGIN = start_of_hot_mem, LENGTH = _HOT_MEM_SIZE /* Just over 8 MB */
2929
}
3030

31-
REGION_ALIAS("MEMORY", COLD_MEMORY);
31+
REGION_ALIAS("RAM", COLD_MEMORY);
3232

3333
ENTRY(vexStartup)

0 commit comments

Comments
 (0)