Compare commits
8 Commits
532262f670
...
37e2c78b0b
Author | SHA1 | Date | |
---|---|---|---|
37e2c78b0b | |||
e85a26d90b | |||
c3ff199a09 | |||
6832afa087 | |||
be65301986 | |||
30aa1149a3 | |||
68fc473372 | |||
b5d4bf5528 |
6
stm-firmware/.gitignore
vendored
6
stm-firmware/.gitignore
vendored
@ -8,3 +8,9 @@ reflow-controller.cxxflags
|
||||
reflow-controller.files
|
||||
reflow-controller.includes
|
||||
*.creator.user
|
||||
*.cflags
|
||||
*.creator
|
||||
*.cxxflags
|
||||
*.includes
|
||||
*.config
|
||||
*.files
|
||||
|
@ -47,8 +47,9 @@ CFILES += temp-converter.c
|
||||
|
||||
CFILES += rotary-encoder.c
|
||||
|
||||
CFILES += stack-check.c
|
||||
|
||||
DEFINES += -DDEBUGBUILD
|
||||
#TODO
|
||||
|
||||
###################################################################################
|
||||
CC=arm-none-eabi-gcc
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -13,7 +13,7 @@ license_header = """/* Reflow Oven Controller
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -14,7 +14,7 @@ license_header = """/* Reflow Oven Controller
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
41
stm-firmware/include/reflow-controller/stack-check.h
Normal file
41
stm-firmware/include/reflow-controller/stack-check.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __STACK_CHECK_H__
|
||||
#define __STACK_CHECK_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define STACK_CHECK_MIN_HEAP_GAP 16UL
|
||||
|
||||
int32_t stack_check_get_usage();
|
||||
|
||||
int32_t stack_check_get_free();
|
||||
|
||||
static inline uint32_t read_stack_pointer()
|
||||
{
|
||||
uint32_t stack_pointer;
|
||||
|
||||
__asm__ __volatile__ ("mov %0, sp\n\t" : "=r"(stack_pointer) : : );
|
||||
|
||||
return stack_pointer;
|
||||
}
|
||||
|
||||
#endif /* __STACK_CHECK_H__ */
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
@ -75,7 +75,7 @@ int main()
|
||||
|
||||
shell_handle = shell_init();
|
||||
|
||||
while(1) {
|
||||
while (1) {
|
||||
pt1000_value_status = adc_pt1000_get_current_resistance(&pt1000_value);
|
||||
rot = rotary_encoder_get_abs_val();
|
||||
uart_receive_status = uart_receive_data_with_dma(&uart_input, &uart_input_len);
|
||||
@ -84,5 +84,3 @@ int main()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
@ -29,6 +29,8 @@
|
||||
#include <stm-periph/unique-id.h>
|
||||
#include <reflow-controller/calibration.h>
|
||||
#include <reflow-controller/temp-converter.h>
|
||||
|
||||
#include <reflow-controller/stack-check.h>
|
||||
#include <reflow-controller/rotary-encoder.h>
|
||||
|
||||
#ifndef GIT_VER
|
||||
@ -203,12 +205,30 @@ static shellmatta_retCode_t shell_cmd_cal(const shellmatta_handle_t handle,
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_get_sp(const shellmatta_handle_t handle,
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
|
||||
shellmatta_printf(handle,
|
||||
"Stack pointer: %p\r\n"
|
||||
"Stack usage: 0x%x bytes\r\n"
|
||||
"Lim to heap: 0x%x bytes\r\n",
|
||||
read_stack_pointer(),
|
||||
stack_check_get_usage(),
|
||||
stack_check_get_free());
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
static shellmatta_retCode_t shell_cmd_rot(const shellmatta_handle_t handle,
|
||||
const char *arguments,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)arguments;
|
||||
(void)length;
|
||||
|
||||
uint32_t rot_val;
|
||||
int32_t delta;
|
||||
|
||||
@ -218,6 +238,7 @@ static shellmatta_retCode_t shell_cmd_rot(const shellmatta_handle_t handle,
|
||||
|
||||
return SHELLMATTA_OK;
|
||||
}
|
||||
|
||||
//typedef struct shellmatta_cmd
|
||||
//{
|
||||
// char *cmd; /**< command name */
|
||||
@ -228,7 +249,7 @@ static shellmatta_retCode_t shell_cmd_rot(const shellmatta_handle_t handle,
|
||||
// struct shellmatta_cmd *next; /**< pointer to next command or NULL */
|
||||
//} shellmatta_cmd_t;
|
||||
|
||||
static shellmatta_cmd_t cmd[8] = {
|
||||
static shellmatta_cmd_t cmd[9] = {
|
||||
{
|
||||
.cmd = "version",
|
||||
.cmdAlias = "ver",
|
||||
@ -285,6 +306,14 @@ static shellmatta_cmd_t cmd[8] = {
|
||||
.cmdFct = shell_cmd_cal,
|
||||
.next = &cmd[7],
|
||||
},
|
||||
{
|
||||
.cmd = "get-stack-pointer",
|
||||
.cmdAlias = "sp",
|
||||
.helpText = "Get the stack pointer",
|
||||
.usageText = "",
|
||||
.cmdFct = shell_get_sp,
|
||||
.next = &cmd[8],
|
||||
},
|
||||
{
|
||||
.cmd = "rotary-encoder",
|
||||
.cmdAlias = "rot",
|
||||
|
47
stm-firmware/stack-check.c
Normal file
47
stm-firmware/stack-check.c
Normal file
@ -0,0 +1,47 @@
|
||||
/* Reflow Oven Controller
|
||||
*
|
||||
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
||||
*
|
||||
* This file is part of the Reflow Oven Controller Project.
|
||||
*
|
||||
* The reflow oven controller is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the reflow oven controller project.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <reflow-controller/stack-check.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern char _estack;
|
||||
extern char heap_top;
|
||||
|
||||
int32_t stack_check_get_usage()
|
||||
{
|
||||
uint32_t stack_top;
|
||||
uint32_t stack_ptr;
|
||||
|
||||
stack_ptr = read_stack_pointer();
|
||||
stack_top = (uint32_t)&_estack;
|
||||
|
||||
return stack_top - stack_ptr;
|
||||
}
|
||||
|
||||
int32_t stack_check_get_free()
|
||||
{
|
||||
uint32_t upper_heap_boundary;
|
||||
uint32_t stack_ptr;
|
||||
|
||||
stack_ptr = read_stack_pointer();
|
||||
upper_heap_boundary = (uint32_t)&heap_top;
|
||||
|
||||
return stack_ptr - upper_heap_boundary;
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
@ -66,7 +66,9 @@ void uart_disable()
|
||||
UART_PERIPH->CR3 = 0;
|
||||
dma_ring_buffer_periph_to_mem_stop(&ring_buff_rx);
|
||||
dma_ring_buffer_mem_to_periph_stop(&ring_buff_tx);
|
||||
#ifdef DEBUGBUILD
|
||||
rcc_manager_disable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(UART_PORT_RCC_MASK));
|
||||
#endif
|
||||
rcc_manager_disable_clock(&RCC->APB2ENR, BITMASK_TO_BITNO(UART_RCC_MASK));
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
@ -8,7 +8,7 @@
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* GDSII-Converter is distributed in the hope that it will be useful,
|
||||
* The Reflow Oven Control Firmware is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
Loading…
x
Reference in New Issue
Block a user