Skip to content

Commit 1a474f8

Browse files
committed
upgrade PROS
1 parent 92d4df6 commit 1a474f8

Some content is hidden

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

47 files changed

+2618
-691
lines changed

common.mk

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ARCHTUPLE=arm-none-eabi-
22
DEVICE=VEX EDR V5
33

4-
MFLAGS=-mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=softfp -Os -g
4+
MFLAGS=-mcpu=cortex-a9 -mfpu=neon-fp16 -mfloat-abi=hard -Os -g -mthumb
55
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

@@ -20,8 +20,8 @@ WARNFLAGS+=-Wno-psabi
2020
SPACE := $() $()
2121
COMMA := ,
2222

23-
C_STANDARD?=gnu11
24-
CXX_STANDARD?=gnu++20
23+
C_STANDARD?=gnu2x
24+
CXX_STANDARD?=gnu++23
2525

2626
DEPDIR := .d
2727
$(shell mkdir -p $(DEPDIR))
@@ -34,7 +34,7 @@ LIBRARIES+=$(wildcard $(FWDIR)/*.a)
3434
EXCLUDE_COLD_LIBRARIES+=$(FWDIR)/libc.a $(FWDIR)/libm.a
3535
COLD_LIBRARIES=$(filter-out $(EXCLUDE_COLD_LIBRARIES), $(LIBRARIES))
3636
wlprefix=-Wl,$(subst $(SPACE),$(COMMA),$1)
37-
LNK_FLAGS=--gc-sections --start-group $(strip $(LIBRARIES)) -lgcc -lstdc++ --end-group -T$(FWDIR)/v5-common.ld
37+
LNK_FLAGS=--gc-sections --start-group $(strip $(LIBRARIES)) -lgcc -lstdc++ --end-group -T$(FWDIR)/v5-common.ld --no-warn-rwx-segments --sort-section=alignment --sort-common
3838

3939
ASMFLAGS=$(MFLAGS) $(WARNFLAGS)
4040
CFLAGS=$(MFLAGS) $(CPPFLAGS) $(WARNFLAGS) $(GCCFLAGS) --std=$(C_STANDARD)
@@ -188,14 +188,14 @@ quick: $(DEFAULT_BIN)
188188

189189
all: clean $(DEFAULT_BIN)
190190

191-
clean:
191+
clean::
192192
@echo Cleaning project
193193
-$Drm -rf $(BINDIR)
194194
-$Drm -rf $(DEPDIR)
195195

196196
ifeq ($(IS_LIBRARY),1)
197197
ifeq ($(LIBNAME),libbest)
198-
$(errror "You should rename your library! libbest is the default library name and should be changed")
198+
$(error "You should rename your library! libbest is the default library name and should be changed")
199199
endif
200200

201201
LIBAR=$(BINDIR)/$(LIBNAME).a
@@ -206,14 +206,15 @@ clean-template:
206206
-$Drm -rf $(TEMPLATE_DIR)
207207

208208
$(LIBAR): $(call GETALLOBJ,$(EXCLUDE_SRC_FROM_LIB)) $(EXTRA_LIB_DEPS)
209+
-$Dmkdir $(BINDIR)
209210
-$Drm -f $@
210211
$(call test_output_2,Creating $@ ,$(AR) rcs $@ $^, $(DONE_STRING))
211212

212213
.PHONY: library
213214
library: $(LIBAR)
214215

215216
.PHONY: template
216-
template: clean-template $(LIBAR)
217+
template:: clean-template $(LIBAR)
217218
$Dpros c create-template . $(LIBNAME) $(VERSION) $(foreach file,$(TEMPLATE_FILES) $(LIBAR),--system "$(file)") --target v5 $(CREATE_TEMPLATE_FLAGS)
218219
endif
219220

@@ -262,7 +263,7 @@ $(foreach asmext,$(ASMEXTS),$(eval $(call asm_rule,$(asmext))))
262263

263264
define c_rule
264265
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1
265-
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 $(DEPDIR)/$(basename $1).d
266+
$(BINDIR)/%.$1.o: $(SRCDIR)/%.$1 $(DEPDIR)/$(basename %).d
266267
$(VV)mkdir -p $$(dir $$@)
267268
$(MAKEDEPFOLDER)
268269
$$(call test_output_2,Compiled $$< ,$(CC) -c $(INCLUDE) -iquote"$(INCDIR)/$$(dir $$*)" $(CFLAGS) $(EXTRA_CFLAGS) $(DEPFLAGS) -o $$@ $$<,$(OK_STRING))
@@ -305,4 +306,4 @@ cxx-sysroot:
305306
$(DEPDIR)/%.d: ;
306307
.PRECIOUS: $(DEPDIR)/%.d
307308

308-
include $(wildcard $(patsubst $(SRCDIR)/%,$(DEPDIR)/%.d,$(CSRC) $(CXXSRC)))
309+
include $(wildcard $(patsubst $(SRCDIR)/%,$(DEPDIR)/%.d,$(CSRC) $(CXXSRC)))

firmware/libc.a

-217 KB
Binary file not shown.

firmware/libm.a

-169 KB
Binary file not shown.

firmware/libpros.a

42.3 KB
Binary file not shown.

firmware/v5-common.ld

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ SECTIONS
132132
*(.gcc_except_table)
133133
} > RAM
134134

135-
.mmu_tbl (ALIGN(16384)) : {
136-
__mmu_tbl_start = .;
137-
*(.mmu_tbl)
138-
__mmu_tbl_end = .;
139-
} > RAM
140-
141135
.ARM.exidx : {
142136
__exidx_start = .;
143137
*(.ARM.exidx*)
@@ -166,11 +160,9 @@ SECTIONS
166160
__fini_array_end = .;
167161
} > RAM
168162

169-
.ARM.attributes : {
170-
__ARM.attributes_start = .;
171-
*(.ARM.attributes)
172-
__ARM.attributes_end = .;
173-
} > RAM
163+
/DISCARD/ : {
164+
*(.ARM.attributes*)
165+
}
174166

175167
.sdata : {
176168
__sdata_start = .;
@@ -228,36 +220,7 @@ _SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
228220
_heap_end = .;
229221
HeapLimit = .;
230222
} > HEAP
231-
232-
.stack (NOLOAD) : {
233-
. = ALIGN(16);
234-
_stack_end = .;
235-
. += _STACK_SIZE;
236-
. = ALIGN(16);
237-
_stack = .;
238-
__stack = _stack;
239-
. = ALIGN(16);
240-
_irq_stack_end = .;
241-
. += _IRQ_STACK_SIZE;
242-
. = ALIGN(16);
243-
__irq_stack = .;
244-
_supervisor_stack_end = .;
245-
. += _SUPERVISOR_STACK_SIZE;
246-
. = ALIGN(16);
247-
__supervisor_stack = .;
248-
_abort_stack_end = .;
249-
. += _ABORT_STACK_SIZE;
250-
. = ALIGN(16);
251-
__abort_stack = .;
252-
_fiq_stack_end = .;
253-
. += _FIQ_STACK_SIZE;
254-
. = ALIGN(16);
255-
__fiq_stack = .;
256-
_undef_stack_end = .;
257-
. += _UNDEF_STACK_SIZE;
258-
. = ALIGN(16);
259-
__undef_stack = .;
260-
} > COLD_MEMORY
261-
223+
/* There are no sections for the stack. This is intentional, since VEXOs sets up a stack before
224+
starting the program, and FreeRTOS task stacks are dynamically allocated. */
262225
_end = .;
263226
}

include/api.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* This file should not be modified by users, since it gets replaced whenever
99
* a kernel upgrade occurs.
1010
*
11-
* \copyright Copyright (c) 2017-2023, Purdue University ACM SIGBots.
11+
* \copyright Copyright (c) 2017-2024, Purdue University ACM SIGBots.
1212
* All rights reserved.
1313
*
1414
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -39,13 +39,8 @@
3939
#include <unistd.h>
4040
#endif /* __cplusplus */
4141

42-
#define PROS_VERSION_MAJOR 4
43-
#define PROS_VERSION_MINOR 1
44-
#define PROS_VERSION_PATCH 1
45-
#define PROS_VERSION_STRING "4.1.1"
46-
47-
4842
#include "pros/adi.h"
43+
#include "pros/ai_vision.h"
4944
#include "pros/colors.h"
5045
#include "pros/device.h"
5146
#include "pros/distance.h"
@@ -65,6 +60,7 @@
6560

6661
#ifdef __cplusplus
6762
#include "pros/adi.hpp"
63+
#include "pros/ai_vision.hpp"
6864
#include "pros/colors.hpp"
6965
#include "pros/device.hpp"
7066
#include "pros/distance.hpp"

include/pros/abstract_motor.hpp

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* This file should not be modified by users, since it gets replaced whenever
1010
* a kernel upgrade occurs.
1111
*
12-
* \copyright Copyright (c) 2017-2023, Purdue University ACM SIGBots.
12+
* \copyright Copyright (c) 2017-2024, Purdue University ACM SIGBots.
1313
* All rights reserved.
1414
*
1515
* This Source Code Form is subject to the terms of the Mozilla Public
@@ -69,6 +69,16 @@ enum class MotorGears {
6969
invalid = INT32_MAX ///< Error return code
7070
};
7171

72+
/**
73+
* \enum MotorType
74+
* Indicates the type of a motor
75+
*/
76+
enum class MotorType {
77+
v5 = 0, ///< 11w motor
78+
exp = 1, ///< 5.5w motor
79+
invalid = INT32_MAX ///< Error return code
80+
};
81+
7282

7383
// Provide Aliases for MotorGears
7484
using MotorGearset = MotorGears;
@@ -957,6 +967,34 @@ class AbstractMotor {
957967
*/
958968
virtual std::vector<std::int32_t> is_reversed_all(void) const = 0;
959969

970+
/**
971+
* Gets the type of the motor
972+
*
973+
* This function uses the following values of errno when an error state is
974+
* reached:
975+
* ENODEV - The port cannot be configured as a motor
976+
*
977+
* \param index Optional parameter.
978+
* The index of the motor to get the target position of.
979+
* By default index is 0, and will return an error for an out of bounds index
980+
*
981+
* \return One of MotorType according to the type of the motor,
982+
* or pros::MotorType::invalid if the operation failed
983+
*/
984+
virtual MotorType get_type(const std::uint8_t index = 0) const = 0;
985+
986+
/**
987+
* Gets a vector of the type(s) of the motor(s).
988+
*
989+
* This function uses the following values of errno when an error state is
990+
* reached:
991+
* ENODEV - The port cannot be configured as a motor
992+
*
993+
* \return A vector of MotorType according to the type(s) of the motor(s),
994+
* or pros::MotorType::invalid if the operation failed.
995+
*/
996+
virtual std::vector<MotorType> get_type_all(void) const = 0;
997+
960998
/**
961999
* Sets one of MotorBrake to the motor. Works with the C enum
9621000
* and the C++ enum class.

include/pros/adi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* This file should not be modified by users, since it gets replaced whenever
88
* a kernel upgrade occurs.
99
*
10-
* \copyright (c) 2017-2023, Purdue University ACM SIGBots.
10+
* \copyright (c) 2017-2024, Purdue University ACM SIGBots.
1111
*
1212
* This Source Code Form is subject to the terms of the Mozilla Public
1313
* License, v. 2.0. If a copy of the MPL was not distributed with this

0 commit comments

Comments
 (0)