1
0
forked from me/IronOS

Debugging history.hpp compiling odd

This commit is contained in:
Ben V. Brown
2020-10-13 22:08:30 +11:00
parent 7da04841d6
commit c8182aa192
5 changed files with 27 additions and 201 deletions

View File

@@ -1,176 +0,0 @@
OUTPUT_ARCH( "riscv" )
ENTRY( _start )
MEMORY
{
/* Run in FLASH */
flash (rxai!w) : ORIGIN = 0x08000000, LENGTH = 128k
ram (wxa!ri) : ORIGIN = 0x20000000, LENGTH = 32K
/* Run in RAM */
/* flash (rxai!w) : ORIGIN = 0x20000000, LENGTH = 24k
ram (wxa!ri) : ORIGIN = 0x20006000, LENGTH = 8K
*/
}
SECTIONS
{
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
.init :
{
KEEP (*(SORT_NONE(.init)))
} >flash AT>flash
.ilalign :
{
. = ALIGN(4);
PROVIDE( _ilm_lma = . );
} >flash AT>flash
.ialign :
{
PROVIDE( _ilm = . );
} >flash AT>flash
.text :
{
*(.rodata .rodata.*)
*(.text.unlikely .text.unlikely.*)
*(.text.startup .text.startup.*)
*(.text .text.*)
*(.gnu.linkonce.t.*)
} >flash AT>flash
.fini :
{
KEEP (*(SORT_NONE(.fini)))
} >flash AT>flash
. = ALIGN(4);
PROVIDE (__etext = .);
PROVIDE (_etext = .);/*0x80022c8*/
PROVIDE (etext = .);/*0x80022c8*/
PROVIDE( _eilm = . );
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >flash AT>flash
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
PROVIDE_HIDDEN (__init_array_end = .);
} >flash AT>flash
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))
KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))
PROVIDE_HIDDEN (__fini_array_end = .);
} >flash AT>flash
.ctors :
{
/* gcc uses crtbegin.o to find the start of
the constructors, so we make sure it is
first. Because this is a wildcard, it
doesn't matter if the user does not
actually link against crtbegin.o; the
linker won't look for a file to match a
wildcard. The wildcard also means that it
doesn't matter which directory crtbegin.o
is in. */
KEEP (*crtbegin.o(.ctors))
KEEP (*crtbegin?.o(.ctors))
/* We don't want to include the .ctor section from
the crtend.o file until after the sorted ctors.
The .ctor section from the crtend file contains the
end of ctors marker and it must be last */
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
} >flash AT>flash
.dtors :
{
KEEP (*crtbegin.o(.dtors))
KEEP (*crtbegin?.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
} >flash AT>flash
. = ALIGN(4);
PROVIDE( _eilm = . );
.lalign :
{
. = ALIGN(4);
PROVIDE( _data_lma = . );
} >flash AT>flash
.dalign :
{
. = ALIGN(4);
PROVIDE( _data = . );
} >ram AT>flash
.data :
{
*(.rdata)
*(.gnu.linkonce.r.*)
*(.data .data.*)
*(.gnu.linkonce.d.*)
. = ALIGN(8);
PROVIDE( __global_pointer$ = . + 0x800);
*(.sdata .sdata.*)
*(.gnu.linkonce.s.*)
. = ALIGN(8);
*(.srodata.cst16)
*(.srodata.cst8)
*(.srodata.cst4)
*(.srodata.cst2)
*(.srodata .srodata.*)
} >ram AT>flash
. = ALIGN(4);
PROVIDE( _edata = . );
PROVIDE( edata = . );
PROVIDE( _fbss = . ); /*0X200052A0 0X200002A0*/
PROVIDE( __bss_start = . );
.bss :
{
*(.sbss*)
*(.gnu.linkonce.sb.*)
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
} >ram AT>ram
. = ALIGN(8);
PROVIDE( _end = . ); /*0X2000,0340*/
PROVIDE( end = . );
PROVIDE( heap_start = . );
.stack ORIGIN(ram) + LENGTH(ram) - __stack_size :
{
PROVIDE( heap_end = . );
. = __stack_size;
PROVIDE( _sp = . );
} >ram AT>ram
}

View File

@@ -45,12 +45,12 @@ void BMA223::getAxisReadings(int16_t& x, int16_t& y, int16_t& z) {
uint8_t sensorData[6] = { 0, 0, 0, 0, 0, 0 };
if (FRToSI2C::Mem_Read(BMA223_ADDRESS, BMA223_ACCD_X_LSB, sensorData, 6) == false) {
x = 0xAAFF;
x = y = z = 0;
return;
}
x = sensorData[1] << 4;
y = sensorData[3] << 4;
z = sensorData[5] << 4;
x = sensorData[1] << 5;
y = sensorData[3] << 5;
z = sensorData[5] << 5;
}

View File

@@ -31,7 +31,7 @@ uint32_t TipThermoModel::convertTipRawADCTouV(uint16_t rawADC) {
// This takes the raw ADC samples, converts these to uV
// Then divides this down by the gain to convert to the uV on the input to the op-amp (A+B terminals)
// Then remove the calibration value that is stored as a tip offset
uint32_t vddRailmVX10 = 33000;//The vreg is +-2%, but we have no higher accuracy available
uint32_t vddRailmVX10 = 33000; //The vreg is +-2%, but we have no higher accuracy available
// 4096 * 8 readings for full scale
// Convert the input ADC reading back into mV times 10 format.
uint32_t rawInputmVX10 = (rawADC * vddRailmVX10) / (4096 * 8);
@@ -64,8 +64,7 @@ uint32_t TipThermoModel::convertTipRawADCToDegF(uint16_t rawADC) {
// [x2, y2] = point 2
// x = input value
// output is x's extrapolated y value
int32_t LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2,
int32_t x) {
int32_t LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x) {
return y1 + (((((x - x1) * 1000) / (x2 - x1)) * (y2 - y1))) / 1000;
}
@@ -95,15 +94,16 @@ uint32_t TipThermoModel::convertCtoF(uint32_t degC) {
uint32_t TipThermoModel::convertFtoC(uint32_t degF) {
//(Y°F 32) × 5/9 = Y°C
if (degF < 32)
return 0;
return 0;
return ((degF - 32) * 5) / 9;
}
#endif
uint32_t TipThermoModel::getTipInC(bool sampleNow) {
uint32_t currentTipTempInC = TipThermoModel::convertTipRawADCToDegC(
getTipRawTemp(sampleNow));
int32_t currentTipTempInC = TipThermoModel::convertTipRawADCToDegC(getTipRawTemp(sampleNow));
currentTipTempInC += getHandleTemperature() / 10; //Add handle offset
if (currentTipTempInC < 0)
return 0;
return currentTipTempInC;
}
#ifdef ENABLED_FAHRENHEIT_SUPPORT
@@ -116,8 +116,7 @@ uint32_t TipThermoModel::getTipInF(bool sampleNow) {
#endif
uint32_t TipThermoModel::getTipMaxInC() {
uint32_t maximumTipTemp = TipThermoModel::convertTipRawADCToDegC(
0x7FFF - (80 * 5)); //back off approx 5 deg c from ADC max
uint32_t maximumTipTemp = TipThermoModel::convertTipRawADCToDegC(0x7FFF - (80 * 5)); //back off approx 5 deg c from ADC max
maximumTipTemp += getHandleTemperature() / 10; //Add handle offset
return maximumTipTemp - 1;
}

View File

@@ -56,7 +56,7 @@ void GUIDelay() {
}
void gui_drawTipTemp(bool symbol) {
// Draw tip temp handling unit conversion & tolerance near setpoint
uint16_t Temp = 0;
uint32_t Temp = 0;
#ifdef ENABLED_FAHRENHEIT_SUPPORT
if (systemSettings.temperatureInF) {
Temp = TipThermoModel::getTipInF();
@@ -581,13 +581,13 @@ void showDebugMenu(void) {
{
uint32_t temp = systemSettings.CalibrationOffset;
systemSettings.CalibrationOffset = 0;
OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(1)), 6);
OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0)), 6);
systemSettings.CalibrationOffset = temp;
}
break;
case 7:
// Temp in C
OLED::printNumber(TipThermoModel::getTipInC(1), 5);
OLED::printNumber(TipThermoModel::getTipInC(), 5);
break;
case 8:
// Handle Temp
@@ -628,7 +628,7 @@ void startGUITask(void const *argument __unused) {
bool tempOnDisplay = false;
{
//Generate the flipped screen into ram for later use
//flipped is generated by flipping each row
//flipped is generated by flipping each row
for (int row = 0; row < 2; row++) {
for (int x = 0; x < 84; x++) {
idleScreenBGF[(row * 84) + x] = idleScreenBG[(row * 84) + (83 - x)];
@@ -716,7 +716,7 @@ void startGUITask(void const *argument __unused) {
currentTempTargetDegC = 0; // ensure tip is off
getInputVoltageX10(systemSettings.voltageDiv, 0);
uint16_t tipTemp = TipThermoModel::getTipInC();
uint32_t tipTemp = TipThermoModel::getTipInC();
// Preemptively turn the display on. Turn it off if and only if
// the tip temperature is below 50 degrees C *and* motion sleep

View File

@@ -53,6 +53,8 @@ DEV_LDFLAGS=
DEV_AFLAGS=
DEV_CFLAGS=
DEV_CXXFLAGS=
flash_size=64k
bootldr_size=0x4000
endif
ifeq ($(model),Pinecil)
@@ -67,10 +69,12 @@ DEVICE_BSP_DIR = ./Core/BSP/Pine64
S_SRCS := $(shell find $(PINE_INC_DIR) -type f -name '*.S')
ASM_INC = -I$(PINE_RISCV_INC_DIR)
LDSCRIPT=GD32VF103xB.ld
DEV_LDFLAGS=-nostartfiles
DEV_GLOBAL_DEFS=-mtune=size -msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common
DEV_LDFLAGS=-nostartfiles -Xlinker
DEV_GLOBAL_DEFS=-msmall-data-limit=8 -mno-save-restore -Os -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -fno-common
DEV_CFLAGS= -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
DEV_CXXFLAGS= -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)"
flash_size=128k
bootldr_size=0x0
endif
INCLUDES = -I$(APP_INC_DIR) \
@@ -99,10 +103,8 @@ OUTPUT_DIR=Objects
# code optimisation ------------------------------------------------------------
OPTIM_AS= -Wall
OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections
OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color -ffunction-sections -fdata-sections
flash_size=64k
bootldr_size=0x4000
# global defines ---------------------------------------------------------------
GLOBAL_DEFINES += -D LANG_$(lang) -D LANG -D MODEL_$(model) $(DEV_GLOBAL_DEFS)
@@ -151,7 +153,8 @@ endif
ifeq ($(model),Pinecil)
CPUFLAGS= -march=rv32imac \
-mabi=ilp32 \
-mcmodel=medany \
-mtune=size \
-mcmodel=medlow \
-DGD32VF103C_START \
-DUSE_STDPERIPH_DRIVER
endif
@@ -159,7 +162,6 @@ endif
# linker flags -----------------------------------------------------------------
LD_FILE = $(PINE_VENDOR_INC_DIR)/GD32VF103xB.lds
LINKER_FLAGS=-Wl,--gc-sections \
-Wl,--wrap=malloc \
-Wl,--wrap=free \
@@ -284,7 +286,8 @@ all: $(OUT_HEXFILE).hex $(OUT_HEXFILE).bin
$(OUT_HEXFILE).elf : $(OUT_OBJS_S) $(OUT_OBJS) $(OUT_OBJS_CPP) Makefile $(LDSCRIPT)
@test -d $(@D) || mkdir -p $(@D)
@echo Linking $(OUTPUT_EXE).elf
@$(CPP) $(CXXFLAGS) $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) $(LIBS) $(LINKER_FLAGS)
@echo $(CPP) $(CXXFLAGS) $(LINKER_FLAGS) $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) $(LIBS)
@$(CPP) $(CXXFLAGS) $(LINKER_FLAGS) $(OUT_OBJS) $(OUT_OBJS_CPP) $(OUT_OBJS_S) $(LIBS)
$(OUT_OBJS): $(OUTPUT_DIR)/%.o : %.c Makefile
@test -d $(@D) || mkdir -p $(@D)