Skip to content

Commit 00b57aa

Browse files
committed
MAX32 OpenOCD cmake and README Updates
Updated the CMake rules for ADI/MAX32 parts using OpenOCD. This corrects for some path mangling due to the MSDK being either Windows or Linux based, and how MAXIM_PATH is set. MAX32 README file updates to reflect the cmake build system updates.
1 parent 2419f65 commit 00b57aa

File tree

2 files changed

+20
-49
lines changed

2 files changed

+20
-49
lines changed

ports/family_support.cmake

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,14 +334,17 @@ endfunction()
334334
# Add flash openocd adi (Analog Devices) target
335335
# included with msdk or compiled from release branch of https://github.com/analogdevicesinc/openocd
336336
function(family_flash_openocd_adi TARGET)
337-
if (DEFINED $ENV{MAXIM_PATH})
338-
# use openocd from msdk with MAXIM_PATH environment variable
339-
set(OPENOCD ENV{MAXIM_PATH}/Tools/OpenOCD/openocd)
340-
set(OPENOCD_OPTION2 "-s $ENV{MAXIM_PATH}/Tools/OpenOCD/scripts")
341-
elseif (DEFINED MAXIM_PATH)
342-
# use openocd from msdk with MAXIM_PATH cmake variable
337+
if (DEFINED MAXIM_PATH)
338+
# use openocd from msdk with MAXIM_PATH cmake variable first if the user
339+
# specified it
343340
set(OPENOCD ${MAXIM_PATH}/Tools/OpenOCD/openocd)
344-
set(OPENOCD_OPTION2 "-s $ENV{MAXIM_PATH}/Tools/OpenOCD/scripts")
341+
set(OPENOCD_OPTION2 "-s ${MAXIM_PATH}/Tools/OpenOCD/scripts")
342+
elseif (DEFINED ENV{MAXIM_PATH})
343+
# use openocd from msdk with MAXIM_PATH environment variable. Normalize
344+
# since msdk can be Windows (MinGW) or Linux
345+
file(TO_CMAKE_PATH "$ENV{MAXIM_PATH}" MAXIM_PATH_NORM)
346+
set(OPENOCD ${MAXIM_PATH_NORM}/Tools/OpenOCD/openocd)
347+
set(OPENOCD_OPTION2 "-s ${MAXIM_PATH_NORM}/Tools/OpenOCD/scripts")
345348
else()
346349
# compiled from source
347350
if (NOT DEFINED OPENOCD_ADI_PATH)

ports/maxim/README.md

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TinyUF2 - MAX32690 Port
22

3-
This folder contains the port of TinyUF2 for Analog Devices' MAX32690 MCU.
3+
This folder contains the port of TinyUF2 for Analog Devices' MAX32xxx/MAX78000 MCUs.
44

55
## Navigation
66

@@ -17,8 +17,6 @@ This folder contains the port of TinyUF2 for Analog Devices' MAX32690 MCU.
1717
- [J-Link vs OpenOCD](#j-link-vs-openocd)
1818
- [Flashing with J-Link](#1-j-link-default)
1919
- [Flashing with OpenOCD (MSDK)](#2-openocd-from-msdk-optional)
20-
- [Notes on SAVELOG=1](#notes-on-savelog1)
21-
- [Cleaning Logs](#cleaning-logs)
2220
- [Flashing Example Applications](#flashing-example-applications)
2321
- [Flashing via Drag-and-Drop](#flashing-via-drag-and-drop)
2422
- [Re-Entering Bootloader Mode](#re-entering-bootloader-mode)
@@ -113,12 +111,6 @@ If you are using your own MSYS2 or mingw installation (not MSDK’s MSYS2), you
113111
export PATH="/c/MaximSDK/Tools/GNUTools/10.3/bin/:$PATH"
114112
```
115113

116-
Or in one-line command for building:
117-
118-
```bash
119-
PATH="/c/MaximSDK/Tools/GNUTools/10.3/bin/:$PATH" make BOARD=apard32690 blinky erase-firmware self-update
120-
```
121-
122114
(Adjust the path if your MSDK installation is in a different location.)
123115

124116
## Available Boards
@@ -135,7 +127,12 @@ For example:
135127
```
136128
tinyuf2/ports/maxim/boards/
137129
apard32690
130+
max32650evkit
131+
max32650fthr
132+
max32666evkit
133+
max32666fthr
138134
max32690evkit
135+
max78002evkit
139136
```
140137

141138
When initially configuring cmake, make sure to specify a valid `BOARD` name from the available list. Otherwise, the build will fail if an invalid board name is provided.
@@ -240,7 +237,10 @@ If you prefer OpenOCD and you have it installed through MSDK:
240237
make tinyuf2-openocd
241238
```
242239
243-
Make sure `MAXIM_PATH` is correctly set to the MSDK base folder. If your default installation of the MSDK is not `C:/MaximSDK` you can pass the MaximSDK directory's location to cmake when configuring the build:
240+
CMake will automatically leverage the MAXIM_PATH system environment variable if
241+
a MAXIM_PATH is not manually specified. To manually specify a MSDK path,
242+
you can pass the MaximSDK directory's location to cmake when configuring the
243+
build:
244244
245245
```bash
246246
cmake -DBOARD=apard32690 -DMAXIM_PATH=/path/to/MaximSDK ..
@@ -251,36 +251,6 @@ or after initial configuration (in the build directory):
251251
cmake -DMAXIM_PATH=C:/MaximSDK .
252252
```
253253
254-
> ⚠️ **Note:**
255-
> Optional flash option when running within an installed MSDK to use OpenOCD. Mainline OpenOCD does not yet have the MAX32's flash algorithm integrated. If the MSDK is installed, tinyuf2-openocd can be run to utilize the modified openocd with the algorithms.
256-
257-
## Notes on SAVELOG=1
258-
259-
Log export options are available for demo apps.
260-
261-
If `SAVELOG=1` is set during a build:
262-
263-
- Output logs are automatically saved into a `logs/` folder inside each application.
264-
- Each application target (e.g., `blinky`, `blinky-clean`) has its own separate subfolder and timestamped `.log` files.
265-
- Log files are ignored from Git version control.
266-
267-
Example:
268-
269-
```
270-
apps/blinky/logs/blinky/blinky_20250425_134500.log
271-
apps/blinky/logs/blinky-clean/blinky-clean_20250425_134512.log
272-
```
273-
274-
## Cleaning Logs
275-
276-
You can remove all saved build logs across all apps by running:
277-
278-
```bash
279-
make BOARD=apard32690 clean-logs
280-
```
281-
282-
This deletes all `logs/` directories under `apps/blinky`, `apps/erase_firmware`, and `apps/self_update`.
283-
284254
## Flashing Example Applications
285255
286256
After building any of the demo applications (Blinky, Erase Firmware, or Self-Update), a UF2 file will be generated in:
@@ -327,8 +297,6 @@ To flash a different application or return to bootloader mode:
327297
328298
## Port Directory Structure
329299
330-
Example directory tree for the MAX32690 port:
331-
332300
```
333301
├── app.cmake
334302
├── board_flash.c

0 commit comments

Comments
 (0)