Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ jobs:
- name: Build PIC32CZ example
working-directory: examples/pic32cz
run: make

- name: Build PIC32CZ hardware tests
working-directory: tests/pic32cz
run: make
1 change: 1 addition & 0 deletions examples/pic32cz/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SOURCE += $(wildcard $(WHAL_DIR)/src/*/clock.c)
SOURCE += $(wildcard $(WHAL_DIR)/src/*/uart.c)
SOURCE += $(wildcard $(WHAL_DIR)/src/*/timer.c)
SOURCE += $(wildcard $(WHAL_DIR)/src/*/supply.c)
SOURCE += $(wildcard $(WHAL_DIR)/src/*/flash.c)
SOURCE += $(wildcard $(WHAL_DIR)/src/*/pic32cz_*.c)
SOURCE += $(wildcard $(WHAL_DIR)/src/*/systick.c)

Expand Down
3 changes: 3 additions & 0 deletions examples/pic32cz/ivt.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ void Reset_Handler(void)
uint32_t* src = &_sidata;
uint32_t* dst = &_sdata;

__asm__("ldr r0, =_estack\n\t"
"mov sp, r0");

while (dst < &_edata) {
*dst++ = *src++;
}
Expand Down
30 changes: 30 additions & 0 deletions examples/pic32cz/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ void main(void)
{
whal_Error err;
uint8_t data[] = "Hello world!\r\n";
uint8_t test[] = "test1\r\n";
uint8_t tmp[sizeof(test)] = {0};

err = whal_Clock_Init(&g_whalClock);
if (err) {
Expand All @@ -58,6 +60,34 @@ void main(void)
goto loop;
}

err = whal_Flash_Init(&g_whalFlash);
if (err) {
goto loop;
}

err = whal_Flash_Erase(&g_whalFlash, 0x0C000000, 0x1000);
if (err) {
goto loop;
}

do {
err = whal_Flash_Write(&g_whalFlash, 0x0C000000, test, sizeof(test));
} while (err == WHAL_ENOTREADY);

if (err) {
goto loop;
}

err = whal_Flash_Read(&g_whalFlash, 0x0C000000, tmp, sizeof(tmp));
if (err) {
goto loop;
}

err = whal_Uart_Send(&g_whalUart, tmp, sizeof(tmp));
if (err) {
goto loop;
}

err = whal_Timer_Init(&g_whalTimer);
if (err) {
goto loop;
Expand Down
4 changes: 4 additions & 0 deletions examples/pic32cz/pic32cz_curiosity_ultra.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ whal_Timer g_whalTimer = {
.tickInt = WHAL_SYSTICK_TICKINT_ENABLED,
},
};

whal_Flash g_whalFlash = {
WHAL_PIC32CZ_FLASH_DEVICE,
};
1 change: 1 addition & 0 deletions examples/pic32cz/pic32cz_curiosity_ultra.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ extern whal_Clock g_whalClock;
extern whal_Gpio g_whalGpio;
extern whal_Timer g_whalTimer;
extern whal_Uart g_whalUart;
extern whal_Flash g_whalFlash;

#endif /* WHAL_PIC32CZ_CURIOSITY_ULTRA */
2 changes: 1 addition & 1 deletion src/clock/pic32cz_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ whal_Error whal_Pic32czClock_GetRate(whal_Clock *clkDev, size_t *rateOut)
return WHAL_SUCCESS;
}

whal_ClockDriver whal_Pic32czClockPll_Driver = {
const whal_ClockDriver whal_Pic32czClockPll_Driver = {
.Init = whal_Pic32czClockPll_Init,
.Deinit = whal_Pic32czClockPll_Deinit,
.Enable = whal_Pic32czClock_Enable,
Expand Down
Loading