Skip to content

Commit

Permalink
Merge pull request #3 from ARMmbed/master
Browse files Browse the repository at this point in the history
merge from master repo
  • Loading branch information
MarianSavchuk authored Mar 7, 2019
2 parents d393e15 + 7f05a61 commit 03e6b46
Show file tree
Hide file tree
Showing 43 changed files with 9,741 additions and 22 deletions.
15 changes: 15 additions & 0 deletions projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ module:
hic_max32620: &module_hic_max32620
- records/rtos/rtos-cm4.yaml
- records/hic_hal/max32620.yaml
hic_max32625: &module_hic_max32625
- records/rtos/rtos-cm4.yaml
- records/hic_hal/max32625.yaml

projects:
kl26z_bl:
Expand Down Expand Up @@ -100,6 +103,10 @@ projects:
- *module_bl
- *module_hic_stm32f103xb
- records/board/stm32f103xb_bl.yaml
max32625_bl:
- *module_bl
- *module_hic_max32625
- records/board/max32625_bl.yaml
stm32f103xb_if:
- *module_if
- *module_hic_stm32f103xb
Expand Down Expand Up @@ -560,3 +567,11 @@ projects:
- *module_if
- *module_hic_max32620
- records/family/all_family.yaml
max32625_max32620fthr_if:
- *module_if
- *module_hic_max32625
- records/board/max32620fthr.yaml
max32625_if:
- *module_if
- *module_hic_max32625
- records/family/all_family.yaml
7 changes: 7 additions & 0 deletions records/board/max32620fthr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
common:
sources:
board:
- source/board/max32620fthr.c
family:
- source/family/maxim/max32620/target.c
- source/family/maxim/max32620/flash_blob.c
4 changes: 4 additions & 0 deletions records/board/max32625_bl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
common:
sources:
board:
- source/board/max32625_bl.c
24 changes: 24 additions & 0 deletions records/hic_hal/max32625.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
common:
target:
- max32625
core:
- Cortex-M4F
macros:
- INTERFACE_MAX32625
- DAPLINK_HIC_ID=0x97969906 # DAPLINK_HIC_ID_MAX32625
includes:
- source/hic_hal/maxim/max32625
sources:
hic_hal:
- source/hic_hal/maxim/max32625
- source/hic_hal/maxim/max32625/armcc

tool_specific:
uvision:
misc:
ld_flags:
- --predefine="-I..\..\..\source\hic_hal\maxim\max32625"
make_armcc:
misc:
ld_flags:
- --predefine="-Isource\hic_hal\maxim\max32625"
30 changes: 30 additions & 0 deletions source/board/max32620fthr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @file max32620fthr.c
* @brief board ID for the Maxim Integrated's MAX32620FTHR
*
* 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 "target_family.h"
#include "target_board.h"

const board_info_t g_board_info = {
.board_id = "0418",
.family_id = kStub_HWReset_FamilyID,
.flags = kEnablePageErase,
.target_cfg = &target_device,
};
52 changes: 52 additions & 0 deletions source/board/max32625_bl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* @file max32625_bl.c
* @brief board ID and meta-data for the hardware interface circuit (HIC) based on 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 "target_config.h"
#include "target_board.h"
#include "target_family.h"

const char *board_id = "0000";

/* ME03 -- MAX32625 512KiB Flash, 160KiB RAM */
target_cfg_t target_device = {
.sector_size = 0x2000,
// Assume memory is regions are same size. Flash algo should ignore requests
// when variable sized sectors exist
// .sector_cnt = ((.flash_end - .flash_start) / .sector_size);
.sector_cnt = ((KB(512) - 0x10000) / 0x2000),
.flash_start = 0x00000000 + 0x10000,
.flash_end = 0x00000000 + KB(512),
.ram_start = 0x20000000,
.ram_end = 0x20028000
/* .flash_algo not needed for bootloader */
};

//bootloader has no family
const target_family_descriptor_t *g_target_family = NULL;

const board_info_t g_board_info = {
.infoVersion = 0x0,
.board_id = "0000",
.daplink_url_name = "HELP_FAQHTM",
.daplink_drive_name = "MAINTENANCE",
.daplink_target_url = "https://mbed.com/daplink",
.target_cfg = &target_device,
};
2 changes: 1 addition & 1 deletion source/daplink/RTX_Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
#define OS_CLOCK 96000000
#elif defined(INTERFACE_STM32F103XB)
#define OS_CLOCK 72000000
#elif defined(INTERFACE_MAX32620)
#elif defined(INTERFACE_MAX32620) || defined(INTERFACE_MAX32625)
#define OS_CLOCK 96000000
#endif
#endif
Expand Down
6 changes: 3 additions & 3 deletions source/daplink/drag-n-drop/vfs_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,8 @@ static void transfer_update_file_info(vfs_file_t file, uint32_t start_sector, ui
}

// Check - stream must be the same
if (stream != file_transfer_state.stream) {
vfs_mngr_printf(" error: changed types during transfer from %i to %i\r\n", stream, file_transfer_state.stream);
if ((stream != STREAM_TYPE_NONE) && (stream != file_transfer_state.stream)) {
vfs_mngr_printf(" error: changed types during transfer from %i to %i\r\n", file_transfer_state.stream, stream);
transfer_update_state(ERROR_ERROR_DURING_TRANSFER);
return;
}
Expand Down Expand Up @@ -675,7 +675,7 @@ static void transfer_stream_open(stream_type_t stream, uint32_t start_sector)

// Check - stream must be the same
if (stream != file_transfer_state.stream) {
vfs_mngr_printf(" error: changed types during tranfer from %i to %i\r\n", stream, file_transfer_state.stream);
vfs_mngr_printf(" error: changed types during transfer from %i to %i\r\n", file_transfer_state.stream, stream);
transfer_update_state(ERROR_ERROR_DURING_TRANSFER);
return;
}
Expand Down
22 changes: 11 additions & 11 deletions source/daplink/drag-n-drop/vfs_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static uint32_t read_file_details_txt(uint32_t sector_offset, uint8_t *data, uin
if (sector_offset != 0) {
return 0;
}

return update_details_txt_file(data, VFS_SECTOR_SIZE);
}

Expand Down Expand Up @@ -353,7 +353,7 @@ static uint32_t read_file_need_bl_txt(uint32_t sector_offset, uint8_t *data, uin


static uint32_t update_html_file(uint8_t *data, uint32_t datasize)
{
{
char *buf = (char *)data;
//Needed by expand_info strlen
memset(buf, 0, datasize);
Expand All @@ -366,12 +366,12 @@ static uint32_t update_details_txt_file(uint8_t *data, uint32_t datasize)
{
uint32_t pos=0;
const char *mode_str;

char *buf = (char *)data;

//Needed by expand_info strlen
memset(buf, 0, datasize);

pos += util_write_string(buf + pos, "# DAPLink Firmware - see https://mbed.com/daplink\r\n");
// Unique ID
pos += util_write_string(buf + pos, "Unique ID: @U\r\n");
Expand Down Expand Up @@ -449,16 +449,16 @@ static uint32_t update_details_txt_file(uint8_t *data, uint32_t datasize)
pos += util_write_string(buf + pos, "Remount count: ");
pos += util_write_uint32(buf + pos, remount_count);
pos += util_write_string(buf + pos, "\r\n");

//Target URL
pos += util_write_string(buf + pos, "URL: @R\r\n");

return expand_info(data, datasize);
}

// Fill buf with the contents of the mbed redirect file by
// expanding the special characters in mbed_redirect_file.
static uint32_t expand_info(uint8_t *buf, uint32_t bufsize)
static uint32_t expand_info(uint8_t *buf, uint32_t bufsize)
{
uint8_t *orig_buf = buf;
uint8_t *insert_string;
Expand Down Expand Up @@ -529,13 +529,13 @@ static uint32_t expand_info(uint8_t *buf, uint32_t bufsize)
memcpy(buf, insert_string, str_len);
}else{
//stop the string expansion and leave as it is
buf += buf_len;
buf += buf_len;
break;
}

}
} while (*buf != '\0');

return (buf - orig_buf);
}

Expand Down
78 changes: 78 additions & 0 deletions source/family/maxim/max32620/flash_blob.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/**
* @file flash_blob.c
* @brief Flash algorithm for the MAX32620
*
* 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 "flash_blob.h"

#define FLC_BASE 0x40002000
#define CLK_DIV 0x00000060
#define BRST_SIZE 0x00000020
#define FLASH_BASE 0x00000000
#define FLASH_SIZE 0x00200000
#define FLASH_SECTOR 0x00002000

#define DEV_CFG_TARGET_ADDRESS (0x0000025cUL) // From flash_algo map file
#define FLASH_ALGO_GEN_ADDER 32
#define DEV_CFG_LOCAL_ADDRESS ((uint8_t*)((unsigned int)flash_algo_blob + DEV_CFG_TARGET_ADDRESS + FLASH_ALGO_GEN_ADDER))

const uint32_t flash_algo_blob[] = {
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
0x4603b510, 0x4893460c, 0x68414448, 0xf0006888, 0xb1087080, 0xbd102001, 0x4448488e, 0x60486880,
0xe7f82000, 0x488b4602, 0x68414448, 0xf0206888, 0x60884070, 0x47702000, 0x44484886, 0x68886841,
0x7080f000, 0x2001b108, 0x6a484770, 0x2000b148, 0x6a486248, 0x2002b128, 0x6a486248, 0x2001b108,
0x6888e7f2, 0x4070f020, 0x5000f040, 0x20006088, 0xb510e7ea, 0x44484877, 0xf7ff6844, 0xb108ffdd,
0xbd102001, 0xf42068a0, 0xf440407f, 0x60a0402a, 0xf04068a0, 0x60a00002, 0x68a0bf00, 0x7080f000,
0xd1fa2800, 0xf02068a0, 0x60a04070, 0xf0006a60, 0xb1080002, 0xe7e42001, 0xe7e22000, 0x4605b570,
0x44484864, 0xf7ff6844, 0xb108ffb7, 0xbd702001, 0xf42068a0, 0xf440407f, 0x60a040aa, 0x68a06025,
0x0004f040, 0xbf0060a0, 0xf00068a0, 0x28007080, 0x68a0d1fa, 0x4070f020, 0x6a6060a0, 0x0002f000,
0x2001b108, 0x2000e7e3, 0xe92de7e1, 0x460747f0, 0x4690468a, 0x4448484f, 0x46566844, 0xf0084645,
0xb1100003, 0xe8bd2001, 0x464587f0, 0xff84f7ff, 0x2001b108, 0x68a0e7f7, 0x6000f020, 0x68a060a0,
0x0010f040, 0xe00e60a0, 0xcd016027, 0x68a06320, 0x0001f040, 0xbf0060a0, 0xf00068a0, 0x28007080,
0x1d3fd1fa, 0x2e041f36, 0xf007d303, 0x2800001f, 0x4838d1ea, 0x68c04448, 0xd1212880, 0xd31f2e10,
0xf02068a0, 0x60a00010, 0xf04068a0, 0x60a06000, 0x6027e014, 0x6320cd01, 0x6360cd01, 0x63a0cd01,
0x63e0cd01, 0xf04068a0, 0x60a00001, 0x68a0bf00, 0x7080f000, 0xd1fa2800, 0x3e103710, 0xd2e82e10,
0xd3192e04, 0xf02068a0, 0x60a06000, 0xf04068a0, 0x60a00010, 0x6027e00e, 0x6320cd01, 0xf04068a0,
0x60a00001, 0x68a0bf00, 0x7080f000, 0xd1fa2800, 0x1f361d3f, 0xd2ee2e04, 0x68a2b306, 0x6200f022,
0x68a260a2, 0x0210f042, 0xf04f60a2, 0x21ff30ff, 0x682ae005, 0x0201ea62, 0x02094010, 0x2e001e76,
0x6027d1f7, 0x68a26320, 0x0201f042, 0xbf0060a2, 0xf00268a2, 0x2a007280, 0xbf00d1fa, 0xf02068a0,
0x60a04070, 0xf0006a60, 0xb1080002, 0xe76a2001, 0xe7682000, 0x00000004, 0x00000000, 0x00000000,
FLC_BASE, CLK_DIV, BRST_SIZE, FLASH_BASE, FLASH_SIZE, FLASH_SECTOR,
};

const program_target_t flash = {
0x20000021, // Init
0x20000045, // UnInit
0x20000093, // EraseChip
0x200000DD, // EraseSector
0x2000012B, // ProgramPage
0x00000000, // Verify

// RSB : base address is address of Execution Region PrgData in map file
// to access global/static data
// RSP : Initial stack pointer
{0x20000001, 0x20000258 + FLASH_ALGO_GEN_ADDER, 0x20001000}, // {breakpoint, RSB, RSP}

0x20000400, // program_buffer
0x20000000, // algo_start
sizeof(flash_algo_blob), // algo_size
flash_algo_blob, // image

512 // ram_to_flash_bytes_to_be_written
};
35 changes: 35 additions & 0 deletions source/family/maxim/max32620/target.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @file target.c
* @brief Target information for the MAX32620
*
* 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 "target_config.h"

extern const program_target_t flash;

/* ME02 -- MAX32620 2MiB Flash, 256KiB RAM */
target_cfg_t target_device = {
.sector_size = 0x2000,
.sector_cnt = (0x200000 / 0x2000),
.flash_start = 0,
.flash_end = 0x200000,
.ram_start = 0x20000000,
.ram_end = 0x20040000,
.flash_algo = (program_target_t *) &flash,
};
Loading

0 comments on commit 03e6b46

Please sign in to comment.