From a668f798700573c5a4fbc0db6186efed04ef9df2 Mon Sep 17 00:00:00 2001
From: Sadik Ozer <sadik.ozer@analog.com>
Date: Fri, 15 Sep 2023 09:56:23 +0300
Subject: [PATCH] Add project files for MAX32625PICO

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
---
 projects.yaml                               |  4 ++
 records/board/max32625pico.yaml             |  7 +++
 source/board/max32625pico.c                 | 35 +++++++++++++
 source/family/maxim/max32625/target_reset.c | 54 ---------------------
 test/info.py                                |  4 ++
 5 files changed, 50 insertions(+), 54 deletions(-)
 create mode 100644 records/board/max32625pico.yaml
 create mode 100644 source/board/max32625pico.c
 delete mode 100644 source/family/maxim/max32625/target_reset.c

diff --git a/projects.yaml b/projects.yaml
index 58de0b43a1..555383da1e 100644
--- a/projects.yaml
+++ b/projects.yaml
@@ -518,6 +518,10 @@ projects:
         - *module_if
         - *module_hic_max32620
         - records/board/max32625mbed.yaml
+    max32625_max32625pico_if:
+        - *module_if
+        - *module_hic_max32625
+        - records/board/max32625pico.yaml
     max32625_max32620fthr_if:
         - *module_if
         - *module_hic_max32625
diff --git a/records/board/max32625pico.yaml b/records/board/max32625pico.yaml
new file mode 100644
index 0000000000..9c8e36df84
--- /dev/null
+++ b/records/board/max32625pico.yaml
@@ -0,0 +1,7 @@
+common:
+    sources:
+        board:
+            - source/board/max32625pico.c
+        family:
+            - source/family/maxim/max32625/target.c
+            - source/family/maxim/target_reset_max32xxx.c
diff --git a/source/board/max32625pico.c b/source/board/max32625pico.c
new file mode 100644
index 0000000000..95ae7406b0
--- /dev/null
+++ b/source/board/max32625pico.c
@@ -0,0 +1,35 @@
+/**
+ * @file    max32625pico.c
+ * @brief   board ID for the Analog Devices's MAX32625PICO
+ *
+ * Copyright (c) 2023 Analog Devices, Inc.
+ * 
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "target_family.h"
+#include "target_board.h"
+
+const board_info_t g_board_info = {
+    .info_version = kBoardInfoVersion,
+    .board_id = "0416",
+    .family_id = kMaxim_MAX3262X_FamilyID,
+    .flags = kEnablePageErase,
+    .target_cfg = &target_device,
+    .daplink_url_name = "MAX32625HTM",
+    .daplink_target_url = "http://www.analog.com/max32625pico",
+    .board_vendor = "Analog Devices",
+    .board_name = "MAX32625PICO",
+};
diff --git a/source/family/maxim/max32625/target_reset.c b/source/family/maxim/max32625/target_reset.c
deleted file mode 100644
index 44530f5161..0000000000
--- a/source/family/maxim/max32625/target_reset.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @file    target_reset.c
- * @brief   Target reset for the MAX32625
- *
- * DAPLink Interface Firmware
- * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "swd_host.h"
-
-void target_before_init_debug(void)
-{
-    // any target specific sequences needed before attaching
-    // to the DAP across JTAG or SWD
-    return;
-}
-
-uint8_t target_unlock_sequence(void)
-{
-    // if the device can secure the flash and there is a way to
-    //  erase all it should be implemented here.
-    return 1;
-}
-
-uint8_t target_set_state(target_state_t state)
-{
-    // invoke reset by sw (VECT_REQ or SYS_REQ) or hw (hardware IO toggle)
-    // return swd_set_target_state_sw(state);
-    //or
-    return swd_set_target_state_hw(state);
-}
-
-uint8_t security_bits_set(uint32_t addr, uint8_t *data, uint32_t size)
-{
-    // if there are security bits in the programmable flash region
-    //  a check should be performed. This method is used when programming
-    //  by drag-n-drop and should refuse to program an image requesting
-    //  to set the device security. This can be performed with the debug channel
-    //  if needed.
-    return 0;
-}
diff --git a/test/info.py b/test/info.py
index ec6eb115c1..8c7c96eac5 100644
--- a/test/info.py
+++ b/test/info.py
@@ -1,6 +1,7 @@
 #
 # DAPLink Interface Firmware
 # Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
+# Portions Copyright (c) 2023 Analog Devices, Inc.
 # SPDX-License-Identifier: Apache-2.0
 #
 # Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -92,6 +93,7 @@
     ('lpc11u35_musca_b_if',                         False,      0x0000,     "bin"       ),
     ('lpc11u35_musca_b_eflash_if',                  False,      0x0000,     "bin"       ),
     ('max32620_max32625mbed_if',                    False,      0x0000,     "bin"       ),
+    ('max32625_max32625pico_if',                    False,      0x0000,     "bin"       ),
     ('max32625_max32620fthr_if',                    False,      0x0000,     "bin"       ),
     ('max32625_max32630fthr_if',                    False,      0x0000,     "bin"       ),
     ('max32625_max32660evsys_if',                   False,      0x0000,     "bin"       ),
@@ -173,6 +175,7 @@ def VENDOR_TO_FAMILY(x, y) : return (VENDOR_ID[x] <<8) | y
     (   0x0360,     VENDOR_TO_FAMILY('NXP', 6),         'lpc4322_hani_iot_if',                      'lpc4322_bl',       'HANI-IOT'                              ),
     (   0x0409,     VENDOR_TO_FAMILY('Stub', 1),        'max32625_max32630fthr_if',                 'max32625_bl',      'MAX32630'                              ),
     (   0x0415,     VENDOR_TO_FAMILY('Stub', 1),        'max32620_max32625mbed_if',                 'max32620_bl',      'MAX32625'                              ),
+    (   0x0416,     VENDOR_TO_FAMILY('Stub', 1),        'max32625_max32625pico_if',                 'max32625_bl',      'MAX32625'                              ),
     (   0x0418,     VENDOR_TO_FAMILY('Stub', 1),        'max32625_max32620fthr_if',                 'max32625_bl',      'MAX32620'                              ),
     (   0x0421,     VENDOR_TO_FAMILY('Stub', 1),        'max32625_max32660evsys_if',                'max32625_bl',      'MAX32660'                              ),
     (   0x0422,     VENDOR_TO_FAMILY('Stub', 1),        'max32625_max32666fthr_if',                 'max32625_bl',      'MAX32666'                              ),
@@ -305,6 +308,7 @@ def VENDOR_TO_FAMILY(x, y) : return (VENDOR_ID[x] <<8) | y
     0x0311,  # K66F
     0x0409,  # MAX32630FTHR
     0x0415,  # MAX32625MBED
+    0x0416,  # MAX32625PICO
     0x0418,  # MAX32620FTHR
     0x0421,  # MAX32660EVSYS
     0x0422,  # MAX32666FTHR