adc-power: update makefiles with work lying around
This commit is contained in:
parent
418b3e1415
commit
19d3225fd6
12 changed files with 185 additions and 20 deletions
10
openocd/openocd.common.cfg
Normal file
10
openocd/openocd.common.cfg
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Shared openocd script helpers
|
||||
|
||||
# put things like "hla_serial 'asdfadfa'" in openocd.<board>.local.cfg to support
|
||||
# multiple simultaneously connected boards.
|
||||
proc optional_local { LOCAL_FILE } {
|
||||
if { [ file exists $LOCAL_FILE ] } {
|
||||
puts "Loading custom local settings from $LOCAL_FILE"
|
||||
source $LOCAL_FILE
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
source [find interface/stlink-v2.cfg]
|
||||
set WORKAREASIZE 0x4000
|
||||
source [find target/stm32f4x.cfg]
|
||||
source [find target/stm32f0x.cfg]
|
||||
|
||||
# My board
|
||||
hla_serial "W?k\x06IgHV0H\x10?"
|
||||
source openocd.common.cfg
|
||||
optional_local "openocd.stm32f072disco.local.cfg"
|
||||
|
||||
tpiu config internal swodump.stm32f4-disco.log uart off 168000000
|
||||
# no trace on cm0
|
||||
#tpiu config internal swodump.stm32f4disco.log uart off 168000000
|
||||
|
||||
# Uncomment to reset on connect, for grabbing under WFI et al
|
||||
reset_config srst_only srst_nogate
|
||||
# reset_config srst_only srst_nogate connect_assert_srst
|
||||
|
||||
2
openocd/openocd.stm32f072disco.local.cfg
Normal file
2
openocd/openocd.stm32f072disco.local.cfg
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# serial of my f072 disco board.
|
||||
hla_serial "Q?o\x06PgHW#$\x16?"
|
||||
|
|
@ -2,12 +2,12 @@ source [find interface/stlink-v2.cfg]
|
|||
set WORKAREASIZE 0x4000
|
||||
source [find target/stm32f4x.cfg]
|
||||
|
||||
# serial of my f4 disco board.
|
||||
hla_serial "W?k\x06IgHV0H\x10?"
|
||||
source openocd.common.cfg
|
||||
optional_local "openocd.stm32f4-disco.local.cfg"
|
||||
|
||||
tpiu config internal swodump.stm32f4disco.log uart off 168000000
|
||||
|
||||
# Uncomment to reset on connect, for grabbing under WFI et al
|
||||
reset_config srst_only srst_nogate
|
||||
# reset_config srst_only srst_nogate connect_assert_srst
|
||||
#reset_config srst_only srst_nogate
|
||||
reset_config srst_only srst_nogate connect_assert_srst
|
||||
|
||||
|
|
|
|||
2
openocd/openocd.stm32f4-disco.local.cfg
Normal file
2
openocd/openocd.stm32f4-disco.local.cfg
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# serial of my f4 disco board.
|
||||
hla_serial "W?k\x06IgHV0H\x10?"
|
||||
15
openocd/openocd.stm32l1-generic.cfg
Normal file
15
openocd/openocd.stm32l1-generic.cfg
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# l1 generic, using a l4 disco board
|
||||
#source [find interface/stlink-v2-1.cfg]
|
||||
# l1 disco itself or similar
|
||||
source [find interface/stlink-v2.cfg]
|
||||
set WORKAREASIZE 0x2000
|
||||
source [find target/stm32l1.cfg]
|
||||
|
||||
#hla_serial "066DFF495351885087171826" # My l4 disco
|
||||
hla_serial "S?l\x06H?WQ%\x10\x18?" # My l1 disco
|
||||
|
||||
tpiu config internal swodump.stm32l1-generic.log uart off 32000000
|
||||
|
||||
# Uncomment to reset on connect, for grabbing under WFI et al
|
||||
reset_config srst_only srst_nogate
|
||||
# reset_config srst_only srst_nogate connect_assert_srst
|
||||
43
tests/adc-power/Makefile.stm32l053-disco
Normal file
43
tests/adc-power/Makefile.stm32l053-disco
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
##
|
||||
## This file is part of the libopencm3 project.
|
||||
##
|
||||
## This library is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU Lesser General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This library 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 Lesser General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU Lesser General Public License
|
||||
## along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
BOARD = stm32l053disco
|
||||
PROJECT = usb-gadget0-$(BOARD)
|
||||
BUILD_DIR = bin-$(BOARD)
|
||||
|
||||
SHARED_DIR = ../shared
|
||||
|
||||
CFILES = main-$(BOARD).c
|
||||
CFILES += usb-gadget0.c
|
||||
|
||||
VPATH += $(SHARED_DIR)
|
||||
|
||||
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
|
||||
|
||||
OPENCM3_DIR=../..
|
||||
|
||||
### This section can go to an arch shared rules eventually...
|
||||
LDSCRIPT = ../../lib/stm32/l0/stm32l0xx8.ld
|
||||
OPENCM3_LIB = opencm3_stm32l0
|
||||
OPENCM3_DEFS = -DSTM32L0
|
||||
#FP_FLAGS ?= -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
ARCH_FLAGS = -mthumb -mcpu=cortex-m0plus $(FP_FLAGS)
|
||||
#OOCD_INTERFACE = stlink-v2-1
|
||||
#OOCD_TARGET = stm32l0
|
||||
OOCD_FILE = ../../openocd/openocd.stm32l053disco.cfg
|
||||
|
||||
include ../rules.mk
|
||||
18
tests/adc-power/Makefile.stm32l1-generic
Normal file
18
tests/adc-power/Makefile.stm32l1-generic
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
BOARD = stm32l1-generic
|
||||
PROJECT = adc-power-$(BOARD)
|
||||
BUILD_DIR = bin-$(BOARD)
|
||||
|
||||
SHARED_DIR = ../../shared
|
||||
|
||||
CFILES = main-$(BOARD).c
|
||||
CFILES += adc-power.c
|
||||
CFILES += trace.c trace_stdio.c
|
||||
|
||||
VPATH += $(SHARED_DIR)
|
||||
|
||||
INCLUDES += $(patsubst %,-I%, . $(SHARED_DIR))
|
||||
|
||||
OPENCM3_DIR=../../libopencm3
|
||||
DEVICE=stm32l151xb
|
||||
OOCD_FILE = openocd.stm32l1-generic.cfg
|
||||
include ../../rules.mk
|
||||
53
tests/adc-power/main-stm32l1-generic.c
Normal file
53
tests/adc-power/main-stm32l1-generic.c
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Oct 2015 Karl Palsson <karlp@tweak.net.au>
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <libopencm3/cm3/nvic.h>
|
||||
#include <libopencm3/stm32/adc.h>
|
||||
#include <libopencm3/stm32/flash.h>
|
||||
#include <libopencm3/stm32/gpio.h>
|
||||
#include <libopencm3/stm32/rcc.h>
|
||||
#include <libopencm3/stm32/usart.h>
|
||||
|
||||
#include "trace.h"
|
||||
#include "adc-power.h"
|
||||
|
||||
#define LED_DISCO_GREEN_PORT GPIOB
|
||||
#define LED_DISCO_GREEN_PIN GPIO7
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
int j = 0;
|
||||
rcc_clock_setup_pll(&rcc_clock_config[RCC_CLOCK_VRANGE1_HSI_PLL_32MHZ]);
|
||||
rcc_periph_clock_enable(RCC_GPIOB);
|
||||
printf("hi guys!\n");
|
||||
/* green led for ticking */
|
||||
gpio_mode_setup(LED_DISCO_GREEN_PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE,
|
||||
LED_DISCO_GREEN_PIN);
|
||||
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO1);
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_ANALOG, GPIO_PUPD_NONE, GPIO5);
|
||||
|
||||
adc_power_init();
|
||||
while (1) {
|
||||
adc_power_task_up();
|
||||
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
|
||||
|
||||
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
|
||||
__asm__("NOP");
|
||||
}
|
||||
adc_power_task_down();
|
||||
gpio_toggle(LED_DISCO_GREEN_PORT, LED_DISCO_GREEN_PIN);
|
||||
for (i = 0; i < 0x100000; i++) { /* Wait a bit. */
|
||||
__asm__("NOP");
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
17
tests/adc-power/openocd.stm32f103-generic.cfg
Normal file
17
tests/adc-power/openocd.stm32f103-generic.cfg
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Unfortunately, with no f103 disco, we're currently
|
||||
# using a separate disco board
|
||||
source [find interface/stlink-v2.cfg]
|
||||
set WORKAREASIZE 0x2000
|
||||
source [find target/stm32f1x.cfg]
|
||||
|
||||
# Serial of my l1 disco used as stlink here.
|
||||
#hla_serial "S?l\x06H?WQ%\x10\x18?"
|
||||
# if f4 disco
|
||||
hla_serial "W?k\x06IgHV0H\x10?"
|
||||
|
||||
tpiu config internal swodump.stm32f103-generic.log uart off 72000000
|
||||
|
||||
# Uncomment to reset on connect, for grabbing under WFI et al
|
||||
reset_config srst_only srst_nogate
|
||||
# reset_config srst_only srst_nogate connect_assert_srst
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
source [find interface/stlink-v2.cfg]
|
||||
set WORKAREASIZE 0x4000
|
||||
source [find target/stm32f3x.cfg]
|
||||
|
||||
# my board
|
||||
hla_serial "S?n\x06gePQ6G%g"
|
||||
|
||||
tpiu config internal swodump.stm32f4-disco.log uart off 72000000
|
||||
|
||||
# Uncomment to reset on connect, for grabbing under WFI et al
|
||||
reset_config srst_only srst_nogate
|
||||
# reset_config srst_only srst_nogate connect_assert_srst
|
||||
15
tests/adc-power/openocd.stm32l1-generic.cfg
Normal file
15
tests/adc-power/openocd.stm32l1-generic.cfg
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# l1 generic, using a l4 disco board
|
||||
#source [find interface/stlink-v2-1.cfg]
|
||||
# l1 disco itself or similar
|
||||
source [find interface/stlink-v2.cfg]
|
||||
set WORKAREASIZE 0x2000
|
||||
source [find target/stm32l1.cfg]
|
||||
|
||||
#hla_serial "066DFF495351885087171826" # My l4 disco
|
||||
hla_serial "S?l\x06H?WQ%\x10\x18?" # My l1 disco
|
||||
|
||||
tpiu config internal swodump.stm32l1-generic.log uart off 32000000
|
||||
|
||||
# Uncomment to reset on connect, for grabbing under WFI et al
|
||||
reset_config srst_only srst_nogate
|
||||
# reset_config srst_only srst_nogate connect_assert_srst
|
||||
Loading…
Add table
Add a link
Reference in a new issue