Skip to content

Commit

Permalink
SUKU swd moved to proper component
Browse files Browse the repository at this point in the history
  • Loading branch information
SukuWc committed Dec 12, 2023
1 parent 3e08dad commit 9411dbf
Show file tree
Hide file tree
Showing 6 changed files with 691 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ void grid_esp32_module_tek2_task(void *arg)

while (1) {


size_t size = 0;

struct grid_esp32_adc_result* result;
Expand Down
8 changes: 8 additions & 0 deletions grid_esp/components/grid_esp32_swd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
idf_component_register(
SRCS
"grid_esp32_swd.c"
INCLUDE_DIRS
"."
REQUIRES
"driver"
)
674 changes: 674 additions & 0 deletions grid_esp/components/grid_esp32_swd/LICENSE

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@

#include "grid_esp32_swd.h"


#include "driver/gpio.h"

#include "esp_rom_gpio.h"
#include "hal/gpio_ll.h"

#include "driver/ledc.h" // for pwm based pico system clock generation
#include "rom/ets_sys.h"

static const char *TAG = "grid_esp32_swd";

static uint8_t swd_pin_swdio;
Expand Down Expand Up @@ -1078,28 +1087,6 @@ void grid_esp32_swd_pico_program_sram(uint8_t swclk_pin, uint8_t swdio_pin, uint
// program_sram
if (1){

// reandom idle
/*
swd_linereset();
swd_idle();
swd_target_select(0); swd_dummy_clock();
swd_read_idcode(); swd_dummy_clock();
swd_write_abort(0x00000010); swd_dummy_clock();
swd_read_dlcr(); swd_dummy_clock(); //0x00000001
swd_read_ap0(); swd_dummy_clock(); //0x00000000
swd_read_buff(); swd_dummy_clock(); //0x30003
swd_linereset();
swd_idle();
swd_target_select(1); swd_dummy_clock();
swd_read_idcode(); swd_dummy_clock();
swd_write_abort(0x00000010); swd_dummy_clock();
swd_read_dlcr(); swd_dummy_clock(); //0x10000001
swd_read_ap0(); swd_dummy_clock(); //0x00000000
swd_read_buff(); swd_dummy_clock(); //0x00040001
*/

// start programming

swd_linereset();
Expand Down Expand Up @@ -1152,36 +1139,6 @@ void grid_esp32_swd_pico_program_sram(uint8_t swclk_pin, uint8_t swdio_pin, uint

}

/*
swd_write_select(0x00000003); swd_dummy_clock();
for(uint32_t i = 0; i<BIN_SIZE+BURST_SIZE; i+=4*BURST_SIZE) {
uint8_t buffer[4*BURST_SIZE] = {0};
esp_flash_read(NULL, buffer, 0x450000 + i, 4*BURST_SIZE);
// select next page
swd_write_ap4(0x20000000+i); swd_dummy_clock();
printf("\r\n\r\n%08lx :: \r\n", i);
for (uint32_t j=0; j<BURST_SIZE; j++){
if (i + j*4<BIN_SIZE){ // BIN_SIZE
uint32_t word = *(uint32_t*)(buffer+j*4);
swd_write_apc(word); // 0x491c481b
//printf(" %08lx", word);
}
}
}
*/

//printf("\r\n END OF DUMP \r\n");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

#ifndef __INCLUDE_GRID_ESP_SWD_H
#define __INCLUDE_GRID_ESP_SWD_H

#pragma once

#include <stdint.h>

#include "driver/gpio.h"

#include "esp_rom_gpio.h"
#include "hal/gpio_ll.h"

#include "driver/ledc.h"

#include "rom/ets_sys.h" // For ets_printf

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -91,7 +76,3 @@ void grid_esp32_swd_pico_program_sram(uint8_t swclk_pin, uint8_t swdio_pin, uint
#ifdef __cplusplus
}
#endif



#endif
1 change: 0 additions & 1 deletion grid_esp/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ idf_component_register(
SRCS
"grid_fw.c"
"grid_esp32.c"
"grid_esp32_swd.c"
"pico_firmware.h"
"grid_esp32_port.c"
"grid_esp32_nvm.c"
Expand Down

0 comments on commit 9411dbf

Please sign in to comment.