First test version to sample temperature input and blink LEDs
This commit is contained in:
		
							
								
								
									
										27
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								main.c
									
									
									
									
									
								
							@@ -1,27 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
 * main.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Apr 25, 2015
 | 
			
		||||
 *      Author: mari
 | 
			
		||||
 */
 | 
			
		||||
#include <stm32f4xx.h>
 | 
			
		||||
//include <arm_math.h>
 | 
			
		||||
#include <system_stm32f4xx.h>
 | 
			
		||||
 | 
			
		||||
#define OUTPUT(pin)  (0b01 << (pin * 2))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
 | 
			
		||||
	RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN;
 | 
			
		||||
	__DSB();
 | 
			
		||||
	GPIOD->MODER = OUTPUT(12);
 | 
			
		||||
	SysTick_Config(8*1680000);
 | 
			
		||||
	while(1);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SysTick_Handler()
 | 
			
		||||
{
 | 
			
		||||
	GPIOD->ODR ^= (1<<12);
 | 
			
		||||
}
 | 
			
		||||
@@ -7,13 +7,19 @@ CFILES 	= main.c syscalls.c UART/uart.c cmsis_boot/system_stm32f4xx.c
 | 
			
		||||
ASFILES = boot/startup_stm32f4xx.S
 | 
			
		||||
INCLUDEPATH = -Iboot -Imathlib -Icmsis -Icmsis_boot -IUART
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OBJDIR = obj
 | 
			
		||||
target	= reflow-controller
 | 
			
		||||
LIBRARYPATH = -L. -Lmathlib
 | 
			
		||||
LIBRARIES = # -larm_cortexM4lf_math
 | 
			
		||||
 | 
			
		||||
DEFINES = -DSTM32F407xx -DSTM32F4XX -DARM_MATH_CM4
 | 
			
		||||
mapfile = qttemplate
 | 
			
		||||
mapfile = memory-mapping
 | 
			
		||||
 | 
			
		||||
ifneq ($(VERBOSE),true)
 | 
			
		||||
QUIET=@
 | 
			
		||||
else
 | 
			
		||||
QUIET=
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
##Custom Files###
 | 
			
		||||
 | 
			
		||||
@@ -22,50 +28,60 @@ mapfile = qttemplate
 | 
			
		||||
###################################################################################
 | 
			
		||||
CC=arm-none-eabi-gcc
 | 
			
		||||
OBJCOPY=arm-none-eabi-objcopy
 | 
			
		||||
 | 
			
		||||
OBJDUMP=arm-none-eabi-objdump
 | 
			
		||||
SIZE=arm-none-eabi-size
 | 
			
		||||
 | 
			
		||||
LFLAGS = -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork 
 | 
			
		||||
LFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 --disable-newlib-supplied-syscalls -nostartfiles
 | 
			
		||||
LFLAGS += -Tstm32f407vet6_flash.ld -Wl,-Map=$(mapfile).map
 | 
			
		||||
 | 
			
		||||
CFLAGS = -c -fmessage-length=0 -mlittle-endian -mthumb -mcpu=cortex-m4 -mthumb-interwork
 | 
			
		||||
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles
 | 
			
		||||
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 -nostartfiles -O0 -g
 | 
			
		||||
 | 
			
		||||
####################################################################################
 | 
			
		||||
 | 
			
		||||
OBJ = $(CFILES:%.c=%.o)
 | 
			
		||||
OBJ += $(ASFILES:%.S=%.o)
 | 
			
		||||
OBJ = $(CFILES:%.c=$(OBJDIR)/%.c.o)
 | 
			
		||||
ASOBJ += $(ASFILES:%.S=$(OBJDIR)/%.S.o)
 | 
			
		||||
 | 
			
		||||
default: $(target).elf
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%.bin: %.elf
 | 
			
		||||
	$(OBJCOPY) -O binary $^ $@
 | 
			
		||||
	$(QUIET)$(OBJCOPY) -O binary $^ $@
 | 
			
		||||
%.hex: %.elf
 | 
			
		||||
	$(OBJCOPY) -O ihex $^ $@
 | 
			
		||||
	$(QUIET)$(OBJCOPY) -O ihex $^ $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#Linking
 | 
			
		||||
$(target).elf: $(OBJ)
 | 
			
		||||
	$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
 | 
			
		||||
$(target).elf: $(OBJ) $(ASOBJ)
 | 
			
		||||
	@echo [LD] $@
 | 
			
		||||
	$(QUIET)$(CC) $(LFLAGS) $(LIBRARYPATH) -o $@ $^ $(LIBRARIES)
 | 
			
		||||
	$(QUIET)$(SIZE) $@
 | 
			
		||||
 | 
			
		||||
#Compiling
 | 
			
		||||
%.o: %.c
 | 
			
		||||
	$(CC) $(CFLAGS) $(INCLUDEPATH) $(DEFINES) -o $@ $<
 | 
			
		||||
$(OBJ):
 | 
			
		||||
	@echo [CC] $@
 | 
			
		||||
	$(eval OUTPATH=$(dir $@))
 | 
			
		||||
	@mkdir -p $(OUTPATH)
 | 
			
		||||
	$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.c.o=%.c)
 | 
			
		||||
$(ASOBJ):
 | 
			
		||||
	@echo [AS] $@
 | 
			
		||||
	$(eval OUTPATH=$(dir $@))
 | 
			
		||||
	@mkdir -p $(OUTPATH)
 | 
			
		||||
	$(QUIET)$(CC) $(CFLAGS) -MMD -MT $@ $(INCLUDEPATH) $(DEFINES) -o $@ $(@:$(OBJDIR)/%.S.o=%.S)	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.PHONY: qtproject clean mrproper objcopy disassemble
 | 
			
		||||
 | 
			
		||||
.PHONY: qtproject clean mrproper objcopy
 | 
			
		||||
disassemble: $(target).elf
 | 
			
		||||
	$(QUIET)$(OBJDUMP) -D -s $< > $(target).lss
 | 
			
		||||
 | 
			
		||||
objcopy: $(target).bin $(target).hex
 | 
			
		||||
 | 
			
		||||
mrproper:
 | 
			
		||||
mrproper: clean
 | 
			
		||||
	rm -f $(target).pro
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(mapfile).map
 | 
			
		||||
	rm -f $(target).elf $(target).bin $(target).hex $(OBJ) $(ASOBJ) $(mapfile).map
 | 
			
		||||
qtproject:
 | 
			
		||||
	echo -e "TEMPLATE = app\nCONFIG -= console app_bundle qt" > $(target).pro
 | 
			
		||||
	echo -e "SOURCES += $(CFILES) $(ASFILES)" >> $(target).pro
 | 
			
		||||
@@ -76,4 +92,4 @@ qtproject:
 | 
			
		||||
	echo -ne "\nDEFINES += " >> $(target).pro
 | 
			
		||||
	echo "$(DEFINES)" | sed "s/-D//g" >> $(target).pro
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-include $(CFILES:%.c=$(OBJDIR)/%.c.d) $(ASFILES:%.S=$(OBJDIR)/%.S.d)
 | 
			
		||||
							
								
								
									
										116
									
								
								stm-firmware/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								stm-firmware/main.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,116 @@
 | 
			
		||||
/*
 | 
			
		||||
 * main.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Created on: Apr 25, 2015
 | 
			
		||||
 *      Author: mari
 | 
			
		||||
 */
 | 
			
		||||
#include <stm32f4xx.h>
 | 
			
		||||
//#include <arm_math.h>
 | 
			
		||||
#include <system_stm32f4xx.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define OUTPUT(pin)  (0b01 << (pin * 2))
 | 
			
		||||
#define ANALOG(pin)  (0x03 << (pin * 2))
 | 
			
		||||
 | 
			
		||||
struct adc_conversions {
 | 
			
		||||
	uint16_t pa2_raw;
 | 
			
		||||
	uint16_t ref_raw;
 | 
			
		||||
	uint16_t temp_raw;
 | 
			
		||||
	uint16_t vbat_raw;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static volatile struct adc_conversions adc_results;
 | 
			
		||||
 | 
			
		||||
volatile uint64_t sample_count = 0;
 | 
			
		||||
volatile uint8_t new_data = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void DMA2_Stream0_IRQHandler()
 | 
			
		||||
{
 | 
			
		||||
	uint32_t lisr;
 | 
			
		||||
 | 
			
		||||
	lisr = DMA2->LISR;
 | 
			
		||||
	DMA2->LIFCR = lisr;
 | 
			
		||||
 | 
			
		||||
	if (lisr & DMA_LISR_TCIF0) {
 | 
			
		||||
		new_data = 1;
 | 
			
		||||
		sample_count++;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void setup_dma(void *dest, size_t size)
 | 
			
		||||
{
 | 
			
		||||
	RCC->AHB1ENR |= RCC_AHB1ENR_DMA2EN;
 | 
			
		||||
 | 
			
		||||
	DMA2_Stream0->M0AR = (uint32_t)dest;
 | 
			
		||||
	DMA2_Stream0->PAR = (uint32_t)&ADC1->DR;
 | 
			
		||||
	DMA2_Stream0->CR = DMA_SxCR_PL_1 | DMA_SxCR_MSIZE_0 | DMA_SxCR_PSIZE_0 | DMA_SxCR_MINC |
 | 
			
		||||
			DMA_SxCR_CIRC | DMA_SxCR_TCIE;
 | 
			
		||||
	DMA2_Stream0->NDTR = size;
 | 
			
		||||
	NVIC_EnableIRQ(DMA2_Stream0_IRQn);
 | 
			
		||||
 | 
			
		||||
	DMA2_Stream0->CR |= DMA_SxCR_EN;
 | 
			
		||||
	new_data = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
float ext_lf_corr;
 | 
			
		||||
 | 
			
		||||
float temp_lf_corr;
 | 
			
		||||
 | 
			
		||||
float ref_lf;
 | 
			
		||||
float vdd_calculated = 3.3f;
 | 
			
		||||
 | 
			
		||||
float vbat_lf_corr;
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
 | 
			
		||||
	struct adc_conversions working;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
 | 
			
		||||
	RCC->APB2ENR |= RCC_APB2ENR_ADC1EN;
 | 
			
		||||
	RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN;
 | 
			
		||||
	__DSB();
 | 
			
		||||
	GPIOB->MODER = OUTPUT(2) | OUTPUT(3);
 | 
			
		||||
	GPIOA->MODER |= ANALOG(2);
 | 
			
		||||
	GPIOB->ODR |= (1<<2);
 | 
			
		||||
	SysTick_Config(8*1680000);
 | 
			
		||||
 | 
			
		||||
	ADC1->SMPR2 = (7U<<(3*2));
 | 
			
		||||
	ADC1->SMPR1 = (7U<<18) | (7U<<21) | (7U<<24);
 | 
			
		||||
	ADC1->SQR1 = (2<<20);
 | 
			
		||||
	ADC1->SQR3 = (2<<0) | (16<<(5*2)) | (17<<(5*1));
 | 
			
		||||
 | 
			
		||||
	ADC->CCR |= (0x2<<16) | ADC_CCR_TSVREFE;
 | 
			
		||||
	ADC1->CR1 = ADC_CR1_SCAN;
 | 
			
		||||
	ADC1->CR2 = ADC_CR2_ADON | ADC_CR2_CONT | ADC_CR2_DMA | ADC_CR2_DDS;
 | 
			
		||||
	
 | 
			
		||||
	//while(1);
 | 
			
		||||
 | 
			
		||||
	setup_dma(&adc_results, 3);
 | 
			
		||||
 | 
			
		||||
	ADC1->CR2 |= ADC_CR2_SWSTART;
 | 
			
		||||
 | 
			
		||||
	while(1) {
 | 
			
		||||
		if (!new_data)
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		new_data = 0;
 | 
			
		||||
		memcpy(&working, &adc_results, sizeof(adc_results));
 | 
			
		||||
 | 
			
		||||
		ref_lf = 0.995f * ref_lf + 0.005f * (float)working.ref_raw;
 | 
			
		||||
		vdd_calculated = ((1.21f * 4096)/ ref_lf);
 | 
			
		||||
 | 
			
		||||
		temp_lf_corr = 0.99f * temp_lf_corr + 0.01 * (float)working.temp_raw * vdd_calculated / 2.495f;
 | 
			
		||||
		ext_lf_corr = 0.995f * ext_lf_corr + 0.005f * (float)working.pa2_raw / 4096 * 2500.0f; // * vdd_calculated / 2.495f;
 | 
			
		||||
 | 
			
		||||
		//vbat_lf_corr = 0.99 * vbat_lf_corr + 0.01 * (float)working.vbat_raw / 4096 * vdd_calculated * 2.0f;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SysTick_Handler()
 | 
			
		||||
{
 | 
			
		||||
	GPIOB->ODR ^= (1<<2) | (1<<3);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										287
									
								
								stm-firmware/reflow-oven-controller.jdebug
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										287
									
								
								stm-firmware/reflow-oven-controller.jdebug
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,287 @@
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*               (c) SEGGER Microcontroller GmbH                      *
 | 
			
		||||
*                        The Embedded Experts                        *
 | 
			
		||||
*                           www.segger.com                           *
 | 
			
		||||
**********************************************************************
 | 
			
		||||
                                                                      
 | 
			
		||||
File          :                                                     
 | 
			
		||||
Created       : 26 Jan 2020  15:46                                                    
 | 
			
		||||
Ozone Version : V2.70                                                    
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       OnProjectLoad                                                 
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Project load routine. Required.                                   
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
void OnProjectLoad (void) {
 | 
			
		||||
  //
 | 
			
		||||
  // Dialog-generated settings
 | 
			
		||||
  //
 | 
			
		||||
  Project.AddPathSubstitute ("/home/mari/projects/arm/reflow-oven-controller", "$(ProjectDir)");
 | 
			
		||||
  Project.AddPathSubstitute ("/home/mari/projects/arm/reflow-oven-controller", "$(ProjectDir)");
 | 
			
		||||
  Project.SetDevice ("STM32F407VE");
 | 
			
		||||
  Project.SetHostIF ("USB", "");
 | 
			
		||||
  Project.SetTargetIF ("SWD");
 | 
			
		||||
  Project.SetTIFSpeed ("4 MHz");
 | 
			
		||||
  Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M4F.svd");
 | 
			
		||||
  Project.AddSvdFile ("/home/mari/Downloads/STM32F407.svd");
 | 
			
		||||
  //
 | 
			
		||||
  // User settings
 | 
			
		||||
  //
 | 
			
		||||
  File.Open ("$(ProjectDir)/reflow-controller.elf");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       OnSnapshotLoad                                                
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Optional event handler, called upon loading a snapshot.           
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Additional information                                              
 | 
			
		||||
*   This function is used to restore the target state in cases        
 | 
			
		||||
*   where values cannot simply be written to the target.              
 | 
			
		||||
*   Typical use: GPIO clock needs to be enabled, before               
 | 
			
		||||
*   GPIO is configured.                                               
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void OnSnapshotLoad (void) {                                        
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       OnSnapshotSave                                                
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Optional event handler, called upon saving a snapshot.            
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Additional information                                              
 | 
			
		||||
*    This function is usually used to save values of the target       
 | 
			
		||||
*    state which can either not be trivially read,                    
 | 
			
		||||
*    or need to be restored in a specific way or order.               
 | 
			
		||||
*    Typically use: Memory Mapped Registers,                          
 | 
			
		||||
*    such as PLL and GPIO configuration.                              
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void OnSnapshotSave (void) {                                        
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*      TargetReset                                                    
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Replaces the default target device reset routine. Optional.       
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Notes                                                               
 | 
			
		||||
*   This example demonstrates the usage when                          
 | 
			
		||||
*   debugging a RAM program on a Cortex-M target device               
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void TargetReset (void) {                                           
 | 
			
		||||
//                                                                    
 | 
			
		||||
//  unsigned int SP;                                                  
 | 
			
		||||
//  unsigned int PC;                                                  
 | 
			
		||||
//  unsigned int VectorTableAddr;                                     
 | 
			
		||||
//                                                                    
 | 
			
		||||
//  Exec.Reset();                                                     
 | 
			
		||||
//                                                                    
 | 
			
		||||
//  VectorTableAddr = Elf.GetBaseAddr();                              
 | 
			
		||||
//                                                                    
 | 
			
		||||
//  if (VectorTableAddr != 0xFFFFFFFF) {                              
 | 
			
		||||
//                                                                    
 | 
			
		||||
//    Util.Log("Resetting Program.");                               
 | 
			
		||||
//                                                                    
 | 
			
		||||
//    SP = Target.ReadU32(VectorTableAddr);                           
 | 
			
		||||
//    Target.SetReg("SP", SP);                                      
 | 
			
		||||
//                                                                    
 | 
			
		||||
//    PC = Target.ReadU32(VectorTableAddr + 4);                       
 | 
			
		||||
//    Target.SetReg("PC", PC);                                      
 | 
			
		||||
//  }                                                                 
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       BeforeTargetReset                                             
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine. Optional.                                  
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void BeforeTargetReset (void) {                                     
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       AfterTargetReset                                              
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine.                                            
 | 
			
		||||
*    - Sets the PC register to program reset value.                   
 | 
			
		||||
*    - Sets the SP register to program reset value on Cortex-M.       
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
void AfterTargetReset (void) {
 | 
			
		||||
  unsigned int SP;                                                
 | 
			
		||||
  unsigned int PC;                                                
 | 
			
		||||
  unsigned int VectorTableAddr;                                   
 | 
			
		||||
                                                                  
 | 
			
		||||
  VectorTableAddr = Elf.GetBaseAddr();                            
 | 
			
		||||
                                                                  
 | 
			
		||||
  if (VectorTableAddr == 0xFFFFFFFF) {                            
 | 
			
		||||
    Util.Log("Project file error: failed to get program base"); 
 | 
			
		||||
  } else {                                                        
 | 
			
		||||
    SP = Target.ReadU32(VectorTableAddr);                         
 | 
			
		||||
    Target.SetReg("SP", SP);                                    
 | 
			
		||||
                                                                  
 | 
			
		||||
    PC = Target.ReadU32(VectorTableAddr + 4);                     
 | 
			
		||||
    Target.SetReg("PC", PC);                                    
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       DebugStart                                                    
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Replaces the default debug session startup routine. Optional.     
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void DebugStart (void) {                                            
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       TargetConnect                                                 
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Replaces the default target IF connection routine. Optional.      
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void TargetConnect (void) {                                         
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       BeforeTargetConnect                                           
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine. Optional.                                  
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void BeforeTargetConnect (void) {                                   
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       AfterTargetConnect                                            
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine. Optional.                                  
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void AfterTargetConnect (void) {                                    
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       TargetDownload                                                
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Replaces the default program download routine. Optional.          
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void TargetDownload (void) {                                        
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       BeforeTargetDownload                                          
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine. Optional.                                  
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void BeforeTargetDownload (void) {                                  
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*      AfterTargetDownload                                            
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine.                                            
 | 
			
		||||
*    - Sets the PC register to program reset value.                   
 | 
			
		||||
*    - Sets the SP register to program reset value on Cortex-M.       
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
void AfterTargetDownload (void) {
 | 
			
		||||
  unsigned int SP;                                                
 | 
			
		||||
  unsigned int PC;                                                
 | 
			
		||||
  unsigned int VectorTableAddr;                                   
 | 
			
		||||
                                                                  
 | 
			
		||||
  VectorTableAddr = Elf.GetBaseAddr();                            
 | 
			
		||||
                                                                  
 | 
			
		||||
  if (VectorTableAddr == 0xFFFFFFFF) {                            
 | 
			
		||||
    Util.Log("Project file error: failed to get program base"); 
 | 
			
		||||
  } else {                                                        
 | 
			
		||||
    SP = Target.ReadU32(VectorTableAddr);                         
 | 
			
		||||
    Target.SetReg("SP", SP);                                    
 | 
			
		||||
                                                                  
 | 
			
		||||
    PC = Target.ReadU32(VectorTableAddr + 4);                     
 | 
			
		||||
    Target.SetReg("PC", PC);                                    
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       BeforeTargetDisconnect                                        
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine. Optional.                                  
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void BeforeTargetDisconnect (void) {                                
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       AfterTargetDisconnect                                         
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine. Optional.                                  
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void AfterTargetDisconnect (void) {                                 
 | 
			
		||||
//}                                                                   
 | 
			
		||||
 | 
			
		||||
/*********************************************************************
 | 
			
		||||
*                                                                     
 | 
			
		||||
*       AfterTargetHalt                                               
 | 
			
		||||
*                                                                     
 | 
			
		||||
* Function description                                                
 | 
			
		||||
*   Event handler routine. Optional.                                  
 | 
			
		||||
*                                                                     
 | 
			
		||||
**********************************************************************
 | 
			
		||||
*/                                                                    
 | 
			
		||||
//void AfterTargetHalt (void) {                                       
 | 
			
		||||
//}                                                                   
 | 
			
		||||
							
								
								
									
										33
									
								
								stm-firmware/reflow-oven-controller.jdebug.user
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								stm-firmware/reflow-oven-controller.jdebug.user
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
 | 
			
		||||
GraphedExpression="ext_lf_corr", DisplayFormat=DISPLAY_FORMAT_DEC
 | 
			
		||||
GraphedExpression="adc_results.pa2_raw", DisplayFormat=DISPLAY_FORMAT_DEC
 | 
			
		||||
GraphedExpression="sample_count", DisplayFormat=DISPLAY_FORMAT_DEC
 | 
			
		||||
GraphedExpression="vdd_calculated"
 | 
			
		||||
OpenDocument="system_stm32f4xx.c", FilePath="/home/mari/projects/arm/reflow-oven-controller/cmsis_boot/system_stm32f4xx.c", Line=308
 | 
			
		||||
OpenDocument="main.c", FilePath="/home/mari/projects/arm/reflow-oven-controller/main.c", Line=55
 | 
			
		||||
OpenDocument="startup_stm32f4xx.S", FilePath="/home/mari/projects/arm/reflow-oven-controller/boot/startup_stm32f4xx.S", Line=58
 | 
			
		||||
OpenToolbar="Debug", Floating=0, x=0, y=0
 | 
			
		||||
OpenWindow="Registers 1", DockArea=RIGHT, x=0, y=1, w=659, h=263, FilterBarShown=0, ToolBarShown=0, FilteredItems=[], RefreshRate=1
 | 
			
		||||
OpenWindow="Source Files", DockArea=LEFT, x=0, y=2, w=285, h=117, FilterBarShown=1, ToolBarShown=0
 | 
			
		||||
OpenWindow="Disassembly", DockArea=RIGHT, x=0, y=0, w=659, h=358, FilterBarShown=0, ToolBarShown=0, ExecCountersShown=0, InstEncodingsShown=0
 | 
			
		||||
OpenWindow="Source", x=0, y=0, w=0, h=0, FilterBarShown=0, ToolBarShown=0, ExecCountersShown=0
 | 
			
		||||
OpenWindow="Break & Tracepoints", DockArea=LEFT, x=0, y=0, w=285, h=398, FilterBarShown=0, ToolBarShown=0, VectorCatchIndexMask=0
 | 
			
		||||
OpenWindow="Memory 1", DockArea=BOTTOM, x=0, y=0, w=578, h=299, FilterBarShown=0, ToolBarShown=0, EditorAddress=0x2001FC2A
 | 
			
		||||
OpenWindow="Watched Data", DockArea=RIGHT, x=0, y=0, w=659, h=358, FilterBarShown=0, ToolBarShown=0
 | 
			
		||||
OpenWindow="Functions", DockArea=LEFT, x=0, y=1, w=285, h=117, FilterBarShown=1, ToolBarShown=0
 | 
			
		||||
OpenWindow="Terminal", DockArea=BOTTOM, x=1, y=0, w=241, h=299, FilterBarShown=0, ToolBarShown=0
 | 
			
		||||
OpenWindow="Data Graph", DockArea=BOTTOM, x=2, y=0, w=850, h=299, FilterBarShown=0, ToolBarShown=0, VisibleTab=0, SamplingFreq=1 kHz, ClearEvent=RESUME, LegendShown=0, UniformSampleSpacing=0, PinCursor=-1, TimePerDiv=10000000
 | 
			
		||||
OpenWindow="Console", DockArea=BOTTOM, x=3, y=0, w=233, h=299, FilterBarShown=0, ToolBarShown=0
 | 
			
		||||
TableHeader="Watched Data", SortCol="Expression", SortOrder="DESCENDING", VisibleCols=["Expression";"Value";"Location";"Size";"Refresh";"Type"], ColWidths=[156;270;84;47;66;231]
 | 
			
		||||
TableHeader="Vector Catches", SortCol="None", SortOrder="ASCENDING", VisibleCols=["";"Vector Catch";"Description"], ColWidths=[50;300;500]
 | 
			
		||||
TableHeader="Break & Tracepoints", SortCol="None", SortOrder="DESCENDING", VisibleCols=["";"Type";"Location";"Extras"], ColWidths=[55;56;86;88]
 | 
			
		||||
TableHeader="Functions", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Address";"Size";"#Insts";"Source"], ColWidths=[170;84;73;63;189]
 | 
			
		||||
TableHeader="Source Files", SortCol="File", SortOrder="ASCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[186;70;63;73;546]
 | 
			
		||||
TableHeader="Data Graph", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time                    ";" ext_lf_corr";" adc_results.pa2_raw";" sample_count";" vdd_calculated"], ColWidths=[147;147;85;85;85;285]
 | 
			
		||||
TableHeader="Data Graph", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[147;147;77;63;77;84;83;98;96]
 | 
			
		||||
TableHeader="Power Graph", SortCol="Index", SortOrder="ASCENDING", VisibleCols=["Index";"Time";"Channel 0"], ColWidths=[84;119;126]
 | 
			
		||||
TableHeader="Registers 1", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Description"], ColWidths=[239;181;259]
 | 
			
		||||
TableHeader="RegisterSelectionDialog", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Auto";"Name";"Address";"Description"], ColWidths=[27;27;27;27]
 | 
			
		||||
WatchedExpression="ext_lf_corr"
 | 
			
		||||
WatchedExpression="adc_results"
 | 
			
		||||
WatchedExpression="vdd_calculated"
 | 
			
		||||
		Reference in New Issue
	
	Block a user