From 49fbfa2cc4fceff6413ace93f731132b855bdb5c Mon Sep 17 00:00:00 2001 From: Penguin Date: Thu, 31 Mar 2022 16:11:40 -0500 Subject: [PATCH] added a printf --- .../clangd/index/main.c.DE834D179AFA9A2E.idx | Bin 6280 -> 6526 bytes .../clangd/index/main.h.511DFA32DBC0CFC0.idx | Bin 764 -> 760 bytes .../clangd/index/putil.c.A85D73FCEC74FEBA.idx | Bin 0 -> 1042 bytes .../clangd/index/putil.h.E7F2470CDC8D3F30.idx | Bin 0 -> 482 bytes Core/Inc/main.h | 1 - Core/Src/main.c | 27 +- Makefile | 8 +- "\\" | 351 +++++++++ compile_commands.json | 673 +----------------- gdb.txt | 203 ++++++ generic_push.gdb | 11 + shared/putil.c | 31 + shared/putil.h | 15 + 13 files changed, 641 insertions(+), 679 deletions(-) create mode 100644 .cache/clangd/index/putil.c.A85D73FCEC74FEBA.idx create mode 100644 .cache/clangd/index/putil.h.E7F2470CDC8D3F30.idx create mode 100644 "\\" create mode 100644 gdb.txt create mode 100644 generic_push.gdb create mode 100644 shared/putil.c create mode 100644 shared/putil.h diff --git a/.cache/clangd/index/main.c.DE834D179AFA9A2E.idx b/.cache/clangd/index/main.c.DE834D179AFA9A2E.idx index 86033e9d94d0432878d5b5840d5ae61b2be1b9a8..c3720b1c2de38228c4fe98b685f4b203b082e953 100644 GIT binary patch literal 6526 zcmb7Ic|4Wb|G%H(Udz3YEEo4$Lc-G&C1OyiC}~xxOuLFSRMVhTCRsvFnTjmg3SH5q zG1^3%M%kOew-J6tv`kG+P0N)1d#>x;=lT8leO@zqz3=;+&vriNb3W%Ro9FJnTc5*m z^PRV6yI;sgE{DU>#Qz6}1br(+98M?xVNXVp*Y@w)Y&8G%e9~?CW~Z9!qNFcNV9i)9 zU9E3ETiaeq+!Oq|dUwgYx1nmeInumu1IN<;Ob-qJ`@z#kVJKpPjdyji&jqwOo?G+N zkGID^qMNtcrMs_-YZ|l8|8r>iw#!Fu6^3%VB)bys#dhz0wtPb7xjOT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zeKLS?x~R}AAN%4*u%fJplPGG%x`1H(=9e-wG9I9*Bh}Lt3I?jGsfg%7T4HU9x`w`m I0WzZg2LNd~umAu6 diff --git a/.cache/clangd/index/main.h.511DFA32DBC0CFC0.idx b/.cache/clangd/index/main.h.511DFA32DBC0CFC0.idx index 3310fecc4a224e64878a96b6330a8e0110dfa19f..ed4f3a4af42b07cb38d45c373d26907cd17bbfda 100644 GIT binary patch literal 760 zcmWIYbaVT_#K7R3;#rZKT9U}Zz`!5?#Kk2=nXiEKbw&n;iaBd19P~SEz|;0w!?NJU z1cju>SEQqq*Iwch)_tzw6)ZL7*u>;jN=J52?kjxKaNyI?e^1ZvKN}|g-rP0%YSwz^ z=efVdax<&zEGJ0YU(1>LnZ5L^iqeBfC$;As9@`%O%{F+Vpdu&8p~0_O_jPu{@7>K& z*RE;GDF%wlY+UYU_vx;)=FUC(JJ(nmA3aj_JXf*BgJs41wHa)^+l1X)#IrS?{@ZbP z#gEv&n*v(QjRG}gx@8SvAqP7GcNf_H;a`8y`23%l;frSLs9oIhwXAr@-1Mz~o~^F_ zRLk_kRbtC|cAp1U-#EJ)=RPm4%uR9w`nYiSl+$7_WmfYr0K5`rWWj*5+9&$=HmxwAup5UPKTKF|<7Dm%lfF$rVS5gH37D|_B&TKBP7NwR zVHXY;A(*h{F4bxK&tB*R3OjN*io=BU-A<^i=x`GR3cGT+!VL-Bx7e`mjdL|n*p9;v zZb)!w;NcSw{k{W*oj9BXVTQm$fsqs9cc^%g&UT|`OjCXWRl9Szi^5dH!UL!p91c+N z#g8Lm1A LX5fap3rGO~3gF%8 literal 764 zcmWIYbaVT{#K7R3;#rZKT9U}Zz`!5?#Kk2=nIC}k6GjGxiaBco4*DH7;5obe$$>=Y zq>E;Ldl#Bs(pqb9v8Zp6$DAoFB77P?MQ%=;u)?~`#UgWR(y_Z` z%7@BdZc-HCs&U$I)ATlDR#@fHIVN?cfBNH^U){;bU+&3siA(&jSFBFlB1u!XYg@jS z70=lE+0M%EQ6P$v7jxK6L7Hwog0^Yzz!sX{>1yoW`ui5bd1#^ELbQ=KK;bNIoGjUZuH4p$+VFw9qsoDknY#V57> z5M7pdU@lO#BZs3POf}4hK-FNMLB;2ve!vqEaq=lpwG)SvI862Ymo1CE8f+?n!p
(t#qVHXY;xRr0qrs=JF%yI`P?9Sm155c0;oJ5eTii?tq!D=}txt`e)%=Rsi Mk(+@V=3WK{04{jn;{X5v diff --git a/.cache/clangd/index/putil.c.A85D73FCEC74FEBA.idx b/.cache/clangd/index/putil.c.A85D73FCEC74FEBA.idx new file mode 100644 index 0000000000000000000000000000000000000000..83b3ac00f42876e2f64d1580c651a5d83fff5031 GIT binary patch literal 1042 zcmWIYbaUfkVPJ4h@vO*AElC7283cg1xTGlaGa~~-JW!xw&e~w#Y-vM*tNtGswyUL- zZQ5pd^nr6naMFg%jdQ>4I5DX#+*MomSAqGIf8YDAdlt-k7Q`botMaqk;>t-kj`Q#T z^z!i8s^~k#+P$~zwq>n5bue}Aj{g1n5&i<_+AIW2zc-)W)EVBabDD2sxv=K9^>et{ z9F&XVS6V#Y$M|{;)6w!-2WvLR_O_k=m~o@@iEYliuHUm$4deCq-CZlGlQ%bf$A+de zJFiziWxlu0tef}T)j00f*}8UbFO;&+^980gj;gie`Et~H4D{fKv%&EB1?`&UV@`KQV zliaL9za_7&3%sEft(t3S>{rlS8=vugm!t44C5`*sN<7=A*2MMPll490ezUaftbxn( zO4sm9r<>yU{&sxM-(tQv@uJ=CUgbDPe$}eysRmaOK!LS+I*88Bfa7);kAAW^*VatEvTVuviC6Vi z&n-C~xqWry|D)W#|7T}PM|#iPGA+f1wIro_x$1A`V~-nZ7>X-%lTv_bK&7_girfjM zJYEKM1_o7j5q3E+!N34YBtTFjuDn8iTgfFJ1}&hxG^@0L8apey00SorGb4kxGNT&f zYm-gw{Ri`aDl~yAI9WJ()Yw?qcz`Ncm>4vafGUbo(~1p%>5S#dZHwSv@nVcTs$z^{ zLNJZ8wdV?+%sRUTD9opA+aTBIaalbcs8@(l2yP_I44?x* z0R?lwU+2pVTa!1w0jd^d6lI4A7p3MTg4o4H$;HY*npt(#oI8=Kg3Cjh)KnN$V9FR6 s)DX<%+>{(SAXiRCflXLKT1t|Gos)-`iDar7e zxZ>`~XoY58&X!vs+cynjO+}2Q*ED-^Of+yQ zWxFWEzSrW|2SzF3v&T10xSVgz_DCf%iRYZ7$nK2v4$m!j7wUY=zrK3S_UfH}u8+TF zJrFynas2Fj{$*3=>t)DZ|DT;cH+=O?HZTab<3j3(#jZ z;>s)Jx0PJtVc=n4;E-mO7T{!KWfNfFWMO7x;ALavWPEM1slEST9#920Pz5IoCl4np z3o8#$1q%}c7b{RjQEFOoF_Kw~oDegBLLkr<>}O#$#bz%f7biC-H$Oy>f#Ha_;JJmT zPV8dj;baqJQ-(R@xu~k$avq(zK-G*KjKVP0FjoN02HOr3FG|fx1hI>Yl8eQGG!y5U UmW{988|NA^vNN#5R536B0Lo>VasU7T literal 0 HcmV?d00001 diff --git a/Core/Inc/main.h b/Core/Inc/main.h index 5a927bc..d216dd9 100644 --- a/Core/Inc/main.h +++ b/Core/Inc/main.h @@ -41,7 +41,6 @@ extern "C" { /* Exported constants --------------------------------------------------------*/ /* USER CODE BEGIN EC */ - /* USER CODE END EC */ /* Exported macro ------------------------------------------------------------*/ diff --git a/Core/Src/main.c b/Core/Src/main.c index 7ae6cd8..582982a 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -21,6 +21,8 @@ /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ +#include "putil.h" +#include "stm32l4xx_hal_uart.h" /* USER CODE END Includes */ @@ -39,8 +41,8 @@ /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/ -TIM_HandleTypeDef htim2; +TIM_HandleTypeDef htim2; UART_HandleTypeDef huart2; /* USER CODE BEGIN PV */ @@ -53,7 +55,7 @@ static void MX_GPIO_Init(void); static void MX_TIM2_Init(void); static void MX_USART2_UART_Init(void); /* USER CODE BEGIN PFP */ -void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t duty_cycle_as_percent); +void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent); /* USER CODE END PFP */ @@ -92,16 +94,18 @@ int main(void) MX_GPIO_Init(); MX_TIM2_Init(); MX_USART2_UART_Init(); + p_uart_init(&huart2); /* USER CODE BEGIN 2 */ uint8_t buff[256] = {'\0'}; sprintf(buff, "Hello Worldblahblahfjdslkfjlasdfj\r\n"); HAL_UART_Transmit(&huart2, "...\r\n", sizeof("...\r\n"), 100); HAL_UART_Transmit(&huart2, buff, sizeof(buff), 100); + PDEBUG("hello darkness my old friend\n"); - HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2); - HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_4); - // setPWM(htim2, TIM_CHANNEL_2, 50); - // setPWM(htim2, TIM_CHANNEL_4, 25); + // HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2); + // HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_4); + setPWM(&htim2, TIM_CHANNEL_2, 95); + setPWM(&htim2, TIM_CHANNEL_4, 15); /* USER CODE END 2 */ @@ -301,11 +305,16 @@ static void MX_GPIO_Init(void) void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent) { HAL_TIM_PWM_Stop(timer, channel); - TIM_OC_InitTypeDef sConfigOC; - timer->HAL_TIM_PWM_Init(timer); + // add new period if we need to, but we don't need to here + + TIM_OC_InitTypeDef sConfigOC = {0}; + sConfigOC.OCMode = TIM_OCMODE_PWM1; - sConfigOC.Pulse = (uint32_t)((duty_cycle_as_percent * timer.Init.Period) / 100.0f); + sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; + sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; + sConfigOC.Pulse = (uint32_t)((dc_percent * timer->Init.Period) / 100.0f); + HAL_TIM_PWM_ConfigChannel(timer, &sConfigOC, channel); HAL_TIM_PWM_Start(timer, channel); } diff --git a/Makefile b/Makefile index fbb28ea..3fc68e1 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,8 @@ Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c \ Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c \ Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c \ Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c \ -Core/Src/system_stm32l4xx.c +Core/Src/system_stm32l4xx.c \ +shared/putil.c # ASM sources ASM_SOURCES = \ @@ -119,7 +120,8 @@ C_INCLUDES = \ -IDrivers/STM32L4xx_HAL_Driver/Inc \ -IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy \ -IDrivers/CMSIS/Device/ST/STM32L4xx/Include \ --IDrivers/CMSIS/Include +-IDrivers/CMSIS/Include \ +-Ishared # compile gcc flags @@ -128,7 +130,7 @@ ASFLAGS = $(MCU) $(AS_DEFS) $(AS_INCLUDES) $(OPT) -Wall -fdata-sections -ffuncti CFLAGS += $(MCU) $(C_DEFS) $(C_INCLUDES) $(OPT) -Wall -fdata-sections -ffunction-sections ifeq ($(DEBUG), 1) -CFLAGS += -g -gdwarf-2 +CFLAGS += -g -gdwarf-2 -DDEBUG endif diff --git "a/\\" "b/\\" new file mode 100644 index 0000000..626e2d9 --- /dev/null +++ "b/\\" @@ -0,0 +1,351 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file : main.c + * @brief : Main program body + ****************************************************************************** + * @attention + * + * Copyright (c) 2022 STMicroelectronics. + * All rights reserved. + * + * This software is licensed under terms that can be found in the LICENSE file + * in the root directory of this software component. + * If no LICENSE file comes with this software, it is provided AS-IS. + * + ****************************************************************************** + */ +/* USER CODE END Header */ +/* Includes ------------------------------------------------------------------*/ +#include "main.h" + +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ +#include "putil.h" + +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN PTD */ + +/* USER CODE END PTD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Private variables ---------------------------------------------------------*/ + +TIM_HandleTypeDef htim2; + +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +void SystemClock_Config(void); +static void MX_GPIO_Init(void); +static void MX_TIM2_Init(void); +static void MX_USART2_UART_Init(void); +/* USER CODE BEGIN PFP */ +void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent); + +/* USER CODE END PFP */ + +/* Private user code ---------------------------------------------------------*/ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/** + * @brief The application entry point. + * @retval int + */ +int main(void) +{ + /* USER CODE BEGIN 1 */ + + /* USER CODE END 1 */ + + /* MCU Configuration--------------------------------------------------------*/ + + /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ + HAL_Init(); + + /* USER CODE BEGIN Init */ + + /* USER CODE END Init */ + + /* Configure the system clock */ + SystemClock_Config(); + + /* USER CODE BEGIN SysInit */ + + /* USER CODE END SysInit */ + + /* Initialize all configured peripherals */ + MX_GPIO_Init(); + MX_TIM2_Init(); + MX_USART2_UART_Init(); + p_uart_init(huart2); + /* USER CODE BEGIN 2 */ + uint8_t buff[256] = {'\0'}; + sprintf(buff, "Hello Worldblahblahfjdslkfjlasdfj\r\n"); + HAL_UART_Transmit(&huart2, "...\r\n", sizeof("...\r\n"), 100); + HAL_UART_Transmit(&huart2, buff, sizeof(buff), 100); + PDEBUG("hello darkness my old friend\n"); + + // HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_2); + // HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_4); + setPWM(&htim2, TIM_CHANNEL_2, 95); + setPWM(&htim2, TIM_CHANNEL_4, 15); + + /* USER CODE END 2 */ + + /* Infinite loop */ + /* USER CODE BEGIN WHILE */ + while (1) + { + /* USER CODE END WHILE */ + + /* USER CODE BEGIN 3 */ + } + /* USER CODE END 3 */ +} + +/** + * @brief System Clock Configuration + * @retval None + */ +void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + + /** Configure the main internal regulator output voltage + */ + if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) + { + Error_Handler(); + } + + /** Configure LSE Drive Capability + */ + HAL_PWR_EnableBkUpAccess(); + __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); + + /** Initializes the RCC Oscillators according to the specified parameters + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE | RCC_OSCILLATORTYPE_MSI; + RCC_OscInitStruct.LSEState = RCC_LSE_ON; + RCC_OscInitStruct.MSIState = RCC_MSI_ON; + RCC_OscInitStruct.MSICalibrationValue = 0; + RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_MSI; + RCC_OscInitStruct.PLL.PLLM = 1; + RCC_OscInitStruct.PLL.PLLN = 16; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV7; + RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; + RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + + /** Initializes the CPU, AHB and APB buses clocks + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) + { + Error_Handler(); + } + + /** Enable MSI Auto calibration + */ + HAL_RCCEx_EnableMSIPLLMode(); +} + +/** + * @brief TIM2 Initialization Function + * @param None + * @retval None + */ +static void MX_TIM2_Init(void) +{ + + /* USER CODE BEGIN TIM2_Init 0 */ + + /* USER CODE END TIM2_Init 0 */ + + TIM_MasterConfigTypeDef sMasterConfig = {0}; + TIM_OC_InitTypeDef sConfigOC = {0}; + + /* USER CODE BEGIN TIM2_Init 1 */ + + /* USER CODE END TIM2_Init 1 */ + htim2.Instance = TIM2; + htim2.Init.Prescaler = 127; + htim2.Init.CounterMode = TIM_COUNTERMODE_UP; + htim2.Init.Period = 499; + htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; + htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; + if (HAL_TIM_PWM_Init(&htim2) != HAL_OK) + { + Error_Handler(); + } + sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; + sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; + if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK) + { + Error_Handler(); + } + sConfigOC.OCMode = TIM_OCMODE_PWM1; + sConfigOC.Pulse = 250; + sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; + sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; + if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2) != HAL_OK) + { + Error_Handler(); + } + sConfigOC.Pulse = 125; + if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_4) != HAL_OK) + { + Error_Handler(); + } + /* USER CODE BEGIN TIM2_Init 2 */ + + /* USER CODE END TIM2_Init 2 */ + HAL_TIM_MspPostInit(&htim2); +} + +/** + * @brief USART2 Initialization Function + * @param None + * @retval None + */ +static void MX_USART2_UART_Init(void) +{ + + /* USER CODE BEGIN USART2_Init 0 */ + + /* USER CODE END USART2_Init 0 */ + + /* USER CODE BEGIN USART2_Init 1 */ + + /* USER CODE END USART2_Init 1 */ + huart2.Instance = USART2; + huart2.Init.BaudRate = 115200; + huart2.Init.WordLength = UART_WORDLENGTH_8B; + huart2.Init.StopBits = UART_STOPBITS_1; + huart2.Init.Parity = UART_PARITY_NONE; + huart2.Init.Mode = UART_MODE_TX_RX; + huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE; + huart2.Init.OverSampling = UART_OVERSAMPLING_16; + huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; + huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; + if (HAL_UART_Init(&huart2) != HAL_OK) + { + Error_Handler(); + } + /* USER CODE BEGIN USART2_Init 2 */ + + /* USER CODE END USART2_Init 2 */ +} + +/** + * @brief GPIO Initialization Function + * @param None + * @retval None + */ +static void MX_GPIO_Init(void) +{ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* GPIO Ports Clock Enable */ + __HAL_RCC_GPIOC_CLK_ENABLE(); + __HAL_RCC_GPIOA_CLK_ENABLE(); + __HAL_RCC_GPIOB_CLK_ENABLE(); + + /*Configure GPIO pin Output Level */ + HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8 | GPIO_PIN_9, GPIO_PIN_RESET); + + /*Configure GPIO pin Output Level */ + HAL_GPIO_WritePin(LD3_GPIO_Port, LD3_Pin, GPIO_PIN_RESET); + + /*Configure GPIO pins : PA8 PA9 */ + GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /*Configure GPIO pin : LD3_Pin */ + GPIO_InitStruct.Pin = LD3_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; + HAL_GPIO_Init(LD3_GPIO_Port, &GPIO_InitStruct); +} + +/* USER CODE BEGIN 4 */ +void setPWM(TIM_HandleTypeDef *timer, uint32_t channel, uint8_t dc_percent) +{ + HAL_TIM_PWM_Stop(timer, channel); + // add new period if we need to, but we don't need to here + + TIM_OC_InitTypeDef sConfigOC = {0}; + + + sConfigOC.OCMode = TIM_OCMODE_PWM1; + sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; + sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; + sConfigOC.Pulse = (uint32_t)((dc_percent * timer->Init.Period) / 100.0f); + + HAL_TIM_PWM_ConfigChannel(timer, &sConfigOC, channel); + HAL_TIM_PWM_Start(timer, channel); +} +/* USER CODE END 4 */ + +/** + * @brief This function is executed in case of error occurrence. + * @retval None + */ +void Error_Handler(void) +{ + /* USER CODE BEGIN Error_Handler_Debug */ + /* User can add his own implementation to report the HAL error return state */ + __disable_irq(); + while (1) + { + } + /* USER CODE END Error_Handler_Debug */ +} + +#ifdef USE_FULL_ASSERT +/** + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed(uint8_t *file, uint32_t line) +{ + /* USER CODE BEGIN 6 */ + /* User can add his own implementation to report the file name and line number, + ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + /* USER CODE END 6 */ +} +#endif /* USE_FULL_ASSERT */ diff --git a/compile_commands.json b/compile_commands.json index c0218ec..a4fe87e 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -14,320 +14,21 @@ "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", "-IDrivers/CMSIS/Include", + "-Ishared", "-Og", "-Wall", "-fdata-sections", "-ffunction-sections", "-g", "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_rcc.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc.lst", + "-MFbuild/putil.d", + "-Wa,-a,-ad,-alms=build/putil.lst", "-o", - "build/stm32l4xx_hal_rcc.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c" + "build/putil.o", + "shared/putil.c" ], "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal.lst", - "-o", - "build/stm32l4xx_hal.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_exti.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_exti.lst", - "-o", - "build/stm32l4xx_hal_exti.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_exti.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_it.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_it.lst", - "-o", - "build/stm32l4xx_it.o", - "Core/Src/stm32l4xx_it.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Core/Src/stm32l4xx_it.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_pwr_ex.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr_ex.lst", - "-o", - "build/stm32l4xx_hal_pwr_ex.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_msp.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_msp.lst", - "-o", - "build/stm32l4xx_hal_msp.o", - "Core/Src/stm32l4xx_hal_msp.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Core/Src/stm32l4xx_hal_msp.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_gpio.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_gpio.lst", - "-o", - "build/stm32l4xx_hal_gpio.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_rcc_ex.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_rcc_ex.lst", - "-o", - "build/stm32l4xx_hal_rcc_ex.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_i2c_ex.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c_ex.lst", - "-o", - "build/stm32l4xx_hal_i2c_ex.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_uart_ex.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart_ex.lst", - "-o", - "build/stm32l4xx_hal_uart_ex.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart_ex.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_dma.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma.lst", - "-o", - "build/stm32l4xx_hal_dma.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c" + "file": "shared/putil.c" }, { "arguments": [ @@ -344,6 +45,7 @@ "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", "-IDrivers/CMSIS/Include", + "-Ishared", "-Og", "-Wall", "-fdata-sections", @@ -358,366 +60,5 @@ ], "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", "file": "Core/Src/main.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_dma_ex.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_dma_ex.lst", - "-o", - "build/stm32l4xx_hal_dma_ex.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma_ex.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_flash_ramfunc.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ramfunc.lst", - "-o", - "build/stm32l4xx_hal_flash_ramfunc.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_pwr.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_pwr.lst", - "-o", - "build/stm32l4xx_hal_pwr.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_flash_ex.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash_ex.lst", - "-o", - "build/stm32l4xx_hal_flash_ex.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_tim.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim.lst", - "-o", - "build/stm32l4xx_hal_tim.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_flash.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_flash.lst", - "-o", - "build/stm32l4xx_hal_flash.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_i2c.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_i2c.lst", - "-o", - "build/stm32l4xx_hal_i2c.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-x", - "assembler-with-cpp", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/startup_stm32l432xx.d", - "-o", - "build/startup_stm32l432xx.o", - "startup_stm32l432xx.s" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "startup_stm32l432xx.s" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_uart.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_uart.lst", - "-o", - "build/stm32l4xx_hal_uart.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_uart.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_tim_ex.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_tim_ex.lst", - "-o", - "build/stm32l4xx_hal_tim_ex.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/system_stm32l4xx.d", - "-Wa,-a,-ad,-alms=build/system_stm32l4xx.lst", - "-o", - "build/system_stm32l4xx.o", - "Core/Src/system_stm32l4xx.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Core/Src/system_stm32l4xx.c" - }, - { - "arguments": [ - "arm-none-eabi-gcc", - "-c", - "-mcpu=cortex-m4", - "-mthumb", - "-mfpu=fpv4-sp-d16", - "-mfloat-abi=hard", - "-DUSE_HAL_DRIVER", - "-DSTM32L432xx", - "-ICore/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc", - "-IDrivers/STM32L4xx_HAL_Driver/Inc/Legacy", - "-IDrivers/CMSIS/Device/ST/STM32L4xx/Include", - "-IDrivers/CMSIS/Include", - "-Og", - "-Wall", - "-fdata-sections", - "-ffunction-sections", - "-g", - "-gdwarf-2", - "-MFbuild/stm32l4xx_hal_cortex.d", - "-Wa,-a,-ad,-alms=build/stm32l4xx_hal_cortex.lst", - "-o", - "build/stm32l4xx_hal_cortex.o", - "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c" - ], - "directory": "/storage/Shared/Projects/stm32_projects/motor_controller", - "file": "Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c" } ] \ No newline at end of file diff --git a/gdb.txt b/gdb.txt new file mode 100644 index 0000000..ed7a1c5 --- /dev/null +++ b/gdb.txt @@ -0,0 +1,203 @@ +0x08000790 in ?? () +### Assembly ############################################################################################################################################################################################################################### + 0x08000790 ? b.n 0x8000790 + 0x08000792 ? nop + 0x08000794 ? movs r7, #88 ; 0x58 + 0x08000796 ? lsrs r0, r0, #32 + 0x08000798 ? lsls r0, r7, #1 + 0x0800079a ? movs r0, #0 + 0x0800079c ? movs r7, #124 ; 0x7c + 0x0800079e ? lsrs r0, r0, #32 + 0x080007a0 ? movs r4, r5 + 0x080007a2 ? movs r0, #0 +### Breakpoints ############################################################################################################################################################################################################################ +### Expressions ############################################################################################################################################################################################################################ +### History ################################################################################################################################################################################################################################ +### Memory ################################################################################################################################################################################################################################# +### Registers ############################################################################################################################################################################################################################## + r0 0x00000000 r3 0x40000000 r6 0x00000000 r9 0x00000000 r12 0x00001000 pc 0x08000790 msp 0x2000fef8 basepri 0x00 + r1 0x00000000 r4 0x2000002c r7 0x00000000 r10 0x00000000 sp 0x2000fef8 xPSR 0x41000000 psp 0x00000000 faultmask 0x00 + r2 0x00000001 r5 0x00000000 r8 0x00000000 r11 0x00000000 lr 0x08000e3d fpscr 0x00000000 primask 0x00 control 0x00 +### Source ################################################################################################################################################################################################################################# +### Stack ################################################################################################################################################################################################################################## +[0] from 0x08000790 +[1] from 0x08000e3c +### Threads ################################################################################################################################################################################################################################ +[1] id 0 from 0x08000790 +### Variables ############################################################################################################################################################################################################################## +############################################################################################################################################################################################################################################ +Loading section .sec1, size 0x2910 lma 0x8000000 +Start address 0x080027a8, load size 10512 +Transfer rate: 15 KB/sec, 10512 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x080007f0 in ?? () +### Assembly ######################################################################################################## + 0x080007f0 ? b.n 0x80007f0 + 0x080007f2 ? nop + 0x080007f4 ? cmp r0, #112 ; 0x70 + 0x080007f6 ? lsrs r0, r0, #32 + 0x080007f8 ? lsls r0, r7, #1 + 0x080007fa ? movs r0, #0 + 0x080007fc ? cmp r0, #148 ; 0x94 + 0x080007fe ? lsrs r0, r0, #32 + 0x08000800 ? movs r4, r5 + 0x08000802 ? movs r0, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x080007f0 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x41000000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40000000 r8 0x00000000 sp 0x2000fef8 msp 0x2000fef8 control 0x04 + r4 0x2000002c r9 0x00000000 lr 0x08000e9d psp 0x00000000 +### Source ########################################################################################################## +### Stack ########################################################################################################### +[0] from 0x080007f0 +[1] from 0x08000e9c +### Threads ######################################################################################################### +[1] id 0 from 0x080007f0 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .sec1, size 0x2910 lma 0x8000000 +Start address 0x080027a8, load size 10512 +Transfer rate: 15 KB/sec, 10512 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x080007f0 in ?? () +### Assembly ######################################################################################################## + 0x080007f0 ? b.n 0x80007f0 + 0x080007f2 ? nop + 0x080007f4 ? cmp r0, #112 ; 0x70 + 0x080007f6 ? lsrs r0, r0, #32 + 0x080007f8 ? lsls r0, r7, #1 + 0x080007fa ? movs r0, #0 + 0x080007fc ? cmp r0, #148 ; 0x94 + 0x080007fe ? lsrs r0, r0, #32 + 0x08000800 ? movs r4, r5 + 0x08000802 ? movs r0, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x080007f0 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x41000000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40000000 r8 0x00000000 sp 0x2000fef8 msp 0x2000fef8 control 0x04 + r4 0x2000002c r9 0x00000000 lr 0x08000e9d psp 0x00000000 +### Source ########################################################################################################## +### Stack ########################################################################################################### +[0] from 0x080007f0 +[1] from 0x08000e9c +### Threads ######################################################################################################### +[1] id 0 from 0x080007f0 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .sec1, size 0x2910 lma 0x8000000 +Start address 0x080027a8, load size 10512 +Transfer rate: 15 KB/sec, 10512 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x080007f0 in ?? () +### Assembly ######################################################################################################## + 0x080007f0 ? b.n 0x80007f0 + 0x080007f2 ? nop + 0x080007f4 ? cmp r0, #112 ; 0x70 + 0x080007f6 ? lsrs r0, r0, #32 + 0x080007f8 ? lsls r0, r7, #1 + 0x080007fa ? movs r0, #0 + 0x080007fc ? cmp r0, #148 ; 0x94 + 0x080007fe ? lsrs r0, r0, #32 + 0x08000800 ? movs r4, r5 + 0x08000802 ? movs r0, #0 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x00000000 r10 0x00000000 pc 0x080007f0 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x41000000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40000000 r8 0x00000000 sp 0x2000fef8 msp 0x2000fef8 control 0x04 + r4 0x2000002c r9 0x00000000 lr 0x08000e9d psp 0x00000000 +### Source ########################################################################################################## +### Stack ########################################################################################################### +[0] from 0x080007f0 +[1] from 0x08000e9c +### Threads ######################################################################################################### +[1] id 0 from 0x080007f0 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .sec1, size 0x35c8 lma 0x8000000 +Start address 0x080028d8, load size 13768 +Transfer rate: 17 KB/sec, 13768 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] +0x080008b4 in ?? () +### Assembly ######################################################################################################## + 0x080008b4 ? b.n 0x80008b4 + 0x080008b6 ? nop + 0x080008b8 ? lsls r0, r3, #3 + 0x080008ba ? movs r0, #0 + 0x080008bc ? adds r4, #72 ; 0x48 + 0x080008be ? lsrs r0, r0, #32 + 0x080008c0 ? adds r4, #108 ; 0x6c + 0x080008c2 ? lsrs r0, r0, #32 + 0x080008c4 ? adds r4, #116 ; 0x74 + 0x080008c6 ? lsrs r0, r0, #32 +### Breakpoints ##################################################################################################### +### Expressions ##################################################################################################### +### History ######################################################################################################### +### Memory ########################################################################################################## +### Registers ####################################################################################################### + r0 0x00000000 r5 0x08003468 r10 0x00000000 pc 0x080008b4 primask 0x00 + r1 0x00000000 r6 0x00000000 r11 0x00000000 xPSR 0x41000000 basepri 0x00 + r2 0x00000001 r7 0x00000000 r12 0x00001000 fpscr 0x00000010 faultmask 0x00 + r3 0x40000000 r8 0x00000000 sp 0x2000fef8 msp 0x2000fef8 control 0x04 + r4 0x2000008c r9 0x00000000 lr 0x08000f65 psp 0x00000000 +### Source ########################################################################################################## +### Stack ########################################################################################################### +[0] from 0x080008b4 +[1] from 0x08000f64 +### Threads ######################################################################################################### +[1] id 0 from 0x080008b4 +### Variables ####################################################################################################### +##################################################################################################################### +Loading section .sec1, size 0x35c8 lma 0x8000000 +Start address 0x080028d8, load size 13768 +Transfer rate: 17 KB/sec, 13768 bytes/write. +Unable to match requested speed 500 kHz, using 480 kHz +Unable to match requested speed 500 kHz, using 480 kHz +A debugging session is active. + + Inferior 1 [Remote target] will be detached. + +Quit anyway? (y or n) [answered Y; input not from terminal] +[Inferior 1 (Remote target) detached] diff --git a/generic_push.gdb b/generic_push.gdb new file mode 100644 index 0000000..a6b7af9 --- /dev/null +++ b/generic_push.gdb @@ -0,0 +1,11 @@ +set pagination off +set logging file gdb.txt +set logging redirect on +set logging on +set remotetimeout 1 +target extended-remote localhost:3333 +load +monitor reset +q +y + diff --git a/shared/putil.c b/shared/putil.c new file mode 100644 index 0000000..3dedef9 --- /dev/null +++ b/shared/putil.c @@ -0,0 +1,31 @@ +#include "putil.h" +#include +#include +#include + +#define MAX_PRINTF_BUFFER (256) + +UART_HandleTypeDef* huart_inst = NULL; + +int p_printf(const char* fmt, ...) +{ + size_t size_str = strlen(fmt); + if (size_str >= MAX_PRINTF_BUFFER) + { + return -1; + } + uint8_t printf_buffer[MAX_PRINTF_BUFFER]; + memset(printf_buffer, '\0', MAX_PRINTF_BUFFER); + va_list args; + va_start(args, fmt); + vsprintf((char*)printf_buffer, fmt, args); + va_end(args); + HAL_UART_Transmit(huart_inst, printf_buffer, strlen(printf_buffer), 100); + return 0; + + +} +void p_uart_init(UART_HandleTypeDef* huart) +{ + huart_inst = huart; +} diff --git a/shared/putil.h b/shared/putil.h new file mode 100644 index 0000000..6de4d41 --- /dev/null +++ b/shared/putil.h @@ -0,0 +1,15 @@ +#ifndef __PUTIL_H__ +#define __PUTIL_H__ + +#include "stm32l4xx_hal.h" + +int p_printf(const char* fmt, ...); +void p_uart_init(UART_HandleTypeDef* huart); + +#ifdef DEBUG + #define PDEBUG(f_, ...) p_printf((f_), ##__VA_ARGS__) +#else + #define PDEBUG(f_, ...) void((f_), ...) +#endif + +#endif