Skip to content

Instantly share code, notes, and snippets.

@fboris
fboris / Makefile
Created Jun 18, 2019
nordic makefile
View Makefile
PROJECT_NAME := ble_app_uart_s130_pca10028
export OUTPUT_FILENAME
#MAKEFILE_NAME := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
MAKEFILE_NAME := $(MAKEFILE_LIST)
MAKEFILE_DIR := $(dir $(MAKEFILE_NAME) )
TEMPLATE_PATH = ../../../../../../components/toolchain/gcc
ifeq ($(OS),Windows_NT)
include $(TEMPLATE_PATH)/Makefile.windows
View gist:c52a43eb474aa7adb773d7eff49794f2
# openocd setup
source [find interface/jlink.cfg]
transport select swd
source [find target/stm32f1x.cfg]
# write image and restart target
proc program () {
init
@fboris
fboris / stm_native_bootloader.md
Last active Mar 24, 2021
dfu-util command for uploading firmware on ST devices
View stm_native_bootloader.md
  1. Let device to enter dfu-mode. And use dfu-util to get available devices

sudo dfu-util -l

It will show like...

Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=3, name="@Device Feature/0xFFFF0000/01*004 g", serial="3262355B3231"
Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=2, name="@OTP Memory /0x1FFF7800/01*512 g,01*016 g", serial="3262355B3231"
Found DFU: [0483:df11] ver=2100, devnum=32, cfg=1, intf=0, alt=1, name="@Option Bytes  /0x1FFFC000/01*016 g", serial="3262355B3231"
@fboris
fboris / Geometry Note
Last active Aug 29, 2015
Geometry Notes
View Geometry Note
##Use Euler angle to represent direction cosine matrix
$C_b^n = \left[
\begin{array}{clcr}
cos\theta cos\psi & -cos\phi sin\psi+sin\phi sin\theta cos\psi & sin\phi sin\psi + cos\phi sin\theta cos\psi\\
cos\theta sin\psi & cos\phi cos\psi+sin\phi sin\theta cos\psi & -sin\phi cos\psi + cos\phi sin\theta sin\psi\\
-sin\theta & sin\phi cos\theta & cos\phi cos\theta
\end{array}
\right]$
```
View gdb_log_heap4
Attaching to program: /home/fboris/quadrotor_workspace/moon-bear/shengwen_firmware/program/firmware.elf, Remote target
0x08010a32 in __ieee754_sqrtf ()
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) Detaching from program: /home/fboris/quadrotor_workspace/moon-bear/shengwen_firmware/program/firmware.elf, Remote target
Remote debugging using /dev/ttyACM0
Target voltage: unknown
Available Targets:
View gdb log for heap1 bug
A debugging session is active.
Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) Detaching from program: /home/fboris/quadrotor_workspace/moon-bear/shengwen_firmware/program/firmware.elf, Remote target
Remote debugging using /dev/ttyACM0
Target voltage: unknown
Available Targets:
No. Att Driver
1 STM32F4xx
@fboris
fboris / sd_backup
Created Apr 1, 2014
backup sd to single image file
View sd_backup
#!/bin/bash
sudo dd if=/dev/sdb of=odroid.img bs=1M
View scan_subnet
/bin/bash #This script help us to see #This script help us to see availbe client in this sub-net
nmap -sP 192.168.100.0/24 | grep 192.168.*
View interrupt service routine in FreeRTOS
void EXTI9_5_IRQHandler(void)
{
long lHigherPriorityTaskWoken = pdFALSE;
/* Only line 6 is enabled, so there is no need to test which line generated
the interrupt. */
EXTI_ClearITPendingBit( EXTI_Line6 );
/* This interrupt does nothing more than demonstrate how to synchronise a
task with an interrupt. First the handler releases a semaphore.
@fboris
fboris / USART_Init
Created Oct 11, 2013
USART Init Structure definition
View USART_Init
/**
* @brief USART Init Structure definition
*/
typedef struct
{
uint32_t USART_BaudRate; /*!< This member configures the USART communication baud rate.
The baud rate is computed using the following formula:
- IntegerDivider = ((PCLKx) / (16 * (USART_InitStruct->USART_BaudRate)))
- FractionalDivider = ((IntegerDivider - ((u32) IntegerDivider)) * 16) + 0.5 */