Skip to content

Commit

Permalink
v0.6: fixed printf and other minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SMFSW committed May 19, 2017
1 parent efb5989 commit a4edd47
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 37 deletions.
18 changes: 9 additions & 9 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "HARMcksL: ARM HAL toolbox (yet STM32 oriented)"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.5
PROJECT_NUMBER = 0.6

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down Expand Up @@ -2047,15 +2047,15 @@ PREDEFINED = DOXY=1 \
PACK__ \
WEAK__ \
INLINE__ \
__INLINE \
__STATIC_INLINE \
__INLINE=inline \
"__STATIC_INLINE=static inline" \
__WEAK \
__IO \
__O \
__I \
__IOM \
__OM \
__IM \
__IO=volatile \
__O=volatile \
"__I=volatile const" \
__IOM=volatile \
__OM=volatile \
"__IM=volatile const"

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
2 changes: 1 addition & 1 deletion FctERR.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file FctERR.c
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief errors to SMFSW FctERR code
Expand Down
2 changes: 1 addition & 1 deletion FctERR.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file FctERR.h
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief errors to SMFSW FctERR declarations
Expand Down
2 changes: 1 addition & 1 deletion GPIO_ex.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file GPIO_ex.c
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief Simple extension for GPIOs
Expand Down
6 changes: 3 additions & 3 deletions GPIO_ex.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file GPIO_ex.h
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief Simple extension for GPIOs
Expand Down Expand Up @@ -110,7 +110,7 @@ __INLINE void INLINE__ write_GPIO(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, eActOu
#if defined(VERBOSE)
char port[10] = "";
str_GPIO_name(port, GPIOx, GPIO_Pin);
printf("Written %s to %u (%lums)\n", port, HAL_GPIO_ReadPin(GPIOx, GPIO_Pin), HAL_GetTick());
printf("Written %s to %u (%lums)\r\n", port, HAL_GPIO_ReadPin(GPIOx, GPIO_Pin), HAL_GetTick());
#endif
}
}
Expand All @@ -129,7 +129,7 @@ __INLINE GPIO_PinState INLINE__ read_GPIO(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin
GPIO_PinState pin = HAL_GPIO_ReadPin(GPIOx, GPIO_Pin);
char port[10] = "";
str_GPIO_name(port, GPIOx, GPIO_Pin);
printf("Read %s is %u (%lums)\n", port, pin, HAL_GetTick());
printf("Read %s is %u (%lums)\r\n", port, pin, HAL_GetTick());
return pin;
#else
return HAL_GPIO_ReadPin(GPIOx, GPIO_Pin);
Expand Down
Binary file renamed HARMcksL_v0_5.pdf → HARMcksL_v0_6.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion PWM.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file PWM.c
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief Simple PWM handling
Expand Down
2 changes: 1 addition & 1 deletion PWM.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file PWM.h
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief Simple PWM handling
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ Doxygen generated documentation can be found in "HARMcksL_vXXX.pdf"
## Release Notes
Detailed changes will come after v1.0 release

- v0.5: current
- v0.6: current
- Still in beta for some time
30 changes: 15 additions & 15 deletions exceptions.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file exceptions.c
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief Debug tool helpers functions
Expand All @@ -19,44 +19,44 @@ void stackDump(uint32_t stack[])
{
enum { r0, r1, r2, r3, r12, lr, pc, psr};

printf("r0 = 0x%08lx\n", stack[r0]);
printf("r1 = 0x%08lx\n", stack[r1]);
printf("r2 = 0x%08lx\n", stack[r2]);
printf("r3 = 0x%08lx\n", stack[r3]);
printf("r12 = 0x%08lx\n", stack[r12]);
printf("lr = 0x%08lx\n", stack[lr]);
printf("pc = 0x%08lx\n", stack[pc]);
printf("psr = 0x%08lx\n", stack[psr]);
printf("r0 = 0x%08lx\r\n", stack[r0]);
printf("r1 = 0x%08lx\r\n", stack[r1]);
printf("r2 = 0x%08lx\r\n", stack[r2]);
printf("r3 = 0x%08lx\r\n", stack[r3]);
printf("r12 = 0x%08lx\r\n", stack[r12]);
printf("lr = 0x%08lx\r\n", stack[lr]);
printf("pc = 0x%08lx\r\n", stack[pc]);
printf("psr = 0x%08lx\r\n", stack[psr]);
}


void HardFault_Handler_callback(uint32_t stack[])
{
printf("Hard Fault handler\t");
printf("SCB->HFSR = 0x%08lx\n", SCB->HFSR);
printf("SCB->HFSR = 0x%08lx\r\n", SCB->HFSR);

if ((SCB->HFSR & (1 << 30)) != 0)
{
uint32_t CFSRValue = SCB->CFSR;

printf("Hard Fault\t");
printf("SCB->CFSR = 0x%08lx\n", CFSRValue);
printf("SCB->CFSR = 0x%08lx\r\n", CFSRValue);
if ((SCB->CFSR & 0xFFFF0000) != 0)
{
printf("Usage fault: ");
CFSRValue >>= 16; // right shift to lsb
if((CFSRValue & (1 << 9)) != 0) { printf("Zero div\n"); }
if((CFSRValue & (1 << 9)) != 0) { printf("Zero div\r\n"); }
}

if ((SCB->CFSR & 0xFF00) != 0)
{
CFSRValue = ((CFSRValue & 0x0000FF00) >> 8); // mask and shift
printf("Bus fault: 0x%02lx\n", CFSRValue);
printf("Bus fault: 0x%02lx\r\n", CFSRValue);
}

if ((SCB->CFSR & 0xFF) != 0) {
CFSRValue &= 0x000000FF; // mask other faults
printf("Memory Management fault: 0x%02lx\n", CFSRValue);
printf("Memory Management fault: 0x%02lx\r\n", CFSRValue);
}
}

Expand All @@ -70,7 +70,7 @@ void HardFault_Handler_callback(uint32_t stack[])
void Error_Handler_callback(uint32_t stack[])
{
// TODO: maybe pass by another asm code to retrieve HAL error code if not in stack
printf("Error handler\n");
printf("Error handler\r\n");
stackDump(stack);

// __BKPT(01);
Expand Down
8 changes: 5 additions & 3 deletions stdream_rdir.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file stdream_rdir.c
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief Stream redirection
Expand All @@ -27,9 +27,11 @@ static char buf_stream[128] = "";
#warning "You have to define DBG_SERIAL in usart.h with an UART instance for this to work!"
#endif

__STATIC_INLINE void INLINE__ print_uart(char* ptr, int len)
__STATIC_INLINE HAL_StatusTypeDef INLINE__ print_uart(char* ptr, int len)
{
HAL_UART_Transmit(DBG_SERIAL, (uint8_t *) ptr, len, 30);
// TODO: find a way to determine if UART interrupts are enabled or not
return HAL_UART_Transmit(DBG_SERIAL, (uint8_t *) ptr, len, 30);
//return HAL_UART_Transmit_IT(DBG_SERIAL, (uint8_t *) ptr, len);
}

#endif
Expand Down
2 changes: 1 addition & 1 deletion stdream_rdir.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!\file stdream_rdir.h
** \author SMFSW
** \version v0.5
** \version v0.6
** \date 2017
** \copyright MIT (c) 2017, SMFSW
** \brief Stream redirection header
Expand Down

0 comments on commit a4edd47

Please sign in to comment.