Skip to content

Commit c3e19da

Browse files
danielinuxdgarske
authored andcommitted
PSOC6: fixed clock setting (added flash wait states), minor include
paths fixes, removed test code
1 parent 6dcbc35 commit c3e19da

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

arch.mk

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,15 @@ ifeq ($(TARGET),psoc6)
165165
$(CYPRESS_PDL)/drivers/source/cy_ble_clk.o \
166166
$(CYPRESS_PDL)/drivers/source/cy_wdt.o \
167167
$(CYPRESS_PDL)/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.o \
168-
$(CYPRESS_TARGET_LIB)/COMPONENT_CM0P/system_psoc6_cm0plus.o
168+
$(CYPRESS_PDL)/devices/templates/COMPONENT_MTB/COMPONENT_CM0P/system_psoc6_cm0plus.o
169169
PKA_EXTRA_CFLAGS+=-I$(CYPRESS_PDL)/drivers/include/ \
170-
-I$(CYPRESS_PDL)/devices/psoc6/psoc63/include/ \
171170
-I$(CYPRESS_PDL)/devices/include \
172171
-I$(CYPRESS_PDL)/cmsis/include \
173172
-I$(CYPRESS_TARGET_LIB) \
174173
-I$(CYPRESS_CORE_LIB)/include \
175-
-DCY8C6248FNI_S2D43
174+
-I$(CYPRESS_PDL)/devices/include/ip \
175+
-I$(CYPRESS_PDL)/devices/templates/COMPONENT_MTB \
176+
-DCY8C624ABZI_D44
176177
ARCH_FLASH_OFFSET=0x10000000
177178
endif
178179

hal/psoc6.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include "cy_syslib.h"
3333
#include "cy_ipc_drv.h"
3434

35+
#include "psoc6_02_config.h"
36+
3537
#define ROW_SIZE (0x1000)
3638
#define FLASH_BASE_ADDRESS (0x10000000)
3739
#define CPU_FREQ (100000000)
@@ -71,7 +73,6 @@ static const cy_stc_pll_manual_config_t srss_0_clock_0_pll_0_pllConfig =
7173
.outputMode = CY_SYSCLK_FLLPLL_OUTPUT_AUTO,
7274
};
7375

74-
#define MPU_CTL *((volatile uint32_t *)(0xE000ED90))
7576
static void hal_set_pll(void)
7677
{
7778
/*Set clock path 1 source to IMO, this feeds PLL1*/
@@ -83,11 +84,16 @@ static void hal_set_pll(void)
8384

8485
/*Set divider for CM4 clock to 0, might be able to lower this to save power if needed*/
8586
Cy_SysClk_ClkFastSetDivider(0U);
87+
8688
/*Set divider for peripheral and CM0 clock to 0 - This must be 0 to get fastest clock to CM0*/
8789
Cy_SysClk_ClkPeriSetDivider(0U);
90+
8891
/*Set divider for CM0 clock to 0*/
8992
Cy_SysClk_ClkSlowSetDivider(0U);
9093

94+
/*Set flash memory wait states */
95+
Cy_SysLib_SetWaitStates(false, 100);
96+
9197
/*Configure PLL for 100 MHz*/
9298
if (CY_SYSCLK_SUCCESS != Cy_SysClk_PllManualConfigure(1U, &srss_0_clock_0_pll_0_pllConfig))
9399
{
@@ -104,11 +110,9 @@ static void hal_set_pll(void)
104110

105111
void hal_init(void)
106112
{
107-
MPU_CTL = 0;
108-
//SystemInit();
109113
Cy_PDL_Init(CY_DEVICE_CFG);
110114
Cy_Flash_Init();
111-
//hal_set_pll();
115+
hal_set_pll();
112116
}
113117

114118
void hal_prepare_boot(void)

0 commit comments

Comments
 (0)