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
12 changes: 6 additions & 6 deletions source/daplink/bootloader/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @brief
*
* DAPLink Interface Firmware
* Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
Expand All @@ -22,11 +22,7 @@
#ifndef MAIN_H
#define MAIN_H

#include "stdint.h"

#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>

/**
* @enum main_usb_busy_t
Expand Down Expand Up @@ -59,6 +55,10 @@ typedef enum {
MAIN_LED_FLASH_PERMANENT
} main_led_state_t;

#ifdef __cplusplus
extern "C" {
#endif

/**
* Allows other parts of the program to request the device to eject physical media
* @param none
Expand Down
5 changes: 2 additions & 3 deletions source/daplink/circ_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "circ_buf.h"

#include "cortex_m.h"
#include "macro.h"
#include "util.h"

void circ_buf_init(circ_buf_t *circ_buf, uint8_t *buffer, uint32_t size)
Expand Down Expand Up @@ -74,7 +73,7 @@ uint8_t circ_buf_pop(circ_buf_t *circ_buf)
}

cortex_int_restore(state);

return data;
}

Expand All @@ -94,7 +93,7 @@ uint32_t circ_buf_count_used(circ_buf_t *circ_buf)
cortex_int_restore(state);
return cnt;
}

uint32_t circ_buf_count_free(circ_buf_t *circ_buf)
{
uint32_t cnt;
Expand Down
4 changes: 2 additions & 2 deletions source/daplink/circ_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#ifndef CIRC_BUF_H
#define CIRC_BUF_H

#include "stdbool.h"
#include "stdint.h"
#include <stdbool.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions source/daplink/cortex_m.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#ifndef CORTEX_M_H
#define CORTEX_M_H

#include "stdint.h"
#include "stdbool.h"
#include <stdint.h>
#include <stdbool.h>

#include "IO_Config.h"

Expand Down
2 changes: 1 addition & 1 deletion source/daplink/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#ifndef _crc_h
#define _crc_h

#include "stdint.h"
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions source/daplink/daplink.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#ifndef DAPLINK_H
#define DAPLINK_H

#include "stdbool.h"
#include "stdint.h"
#include <stdbool.h>
#include <stdint.h>

#include "daplink_addr.h"
#include "compiler.h"
Expand Down
10 changes: 5 additions & 5 deletions source/daplink/daplink_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
#ifndef DAPLINK_DEBUG_H
#define DAPLINK_DEBUG_H

#include "stdarg.h"
#include "stdio.h"
#include "string.h"
#include "stdint.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include "cmsis_os2.h"
#include "rl_usb.h"
#include "macro.h"
#include "util.h"

#ifdef __cplusplus
extern "C" {
Expand Down
5 changes: 2 additions & 3 deletions source/daplink/drag-n-drop/file_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
* limitations under the License.
*/

#include "string.h"
#include <string.h>

#include "file_stream.h"
#include "util.h"
#include "macro.h"
#include "intelhex.h"
#include "flash_decoder.h"
#include "error.h"
Expand Down Expand Up @@ -80,7 +79,7 @@ stream_t stream[] = {
{detect_bin, open_bin, write_bin, close_bin}, // STREAM_TYPE_BIN
{detect_hex, open_hex, write_hex, close_hex}, // STREAM_TYPE_HEX
};
COMPILER_ASSERT(ELEMENTS_IN_ARRAY(stream) == STREAM_TYPE_COUNT);
COMPILER_ASSERT(ARRAY_SIZE(stream) == STREAM_TYPE_COUNT);
// STREAM_TYPE_NONE must not be included in count
COMPILER_ASSERT(STREAM_TYPE_NONE > STREAM_TYPE_COUNT);

Expand Down
2 changes: 1 addition & 1 deletion source/daplink/drag-n-drop/file_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#ifndef FILE_STREAM_H
#define FILE_STREAM_H

#include "stdint.h"
#include <stdint.h>

#include "virtual_fs.h"
#include "error.h"
Expand Down
7 changes: 3 additions & 4 deletions source/daplink/drag-n-drop/flash_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
* limitations under the License.
*/

#include "string.h"
#include <string.h>

#include "flash_decoder.h"
#include "util.h"
#include "macro.h"
#include "daplink.h"
#include "flash_manager.h"
#include "target_config.h" // for target_device
Expand Down Expand Up @@ -353,7 +352,7 @@ static bool flash_decoder_is_at_end(uint32_t addr, const uint8_t *data, uint32_t
case FLASH_DECODER_TYPE_INTERFACE:
end_addr = DAPLINK_ROM_IF_START + DAPLINK_ROM_IF_SIZE;
break;

case FLASH_DECODER_TYPE_TARGET:
//only if we are sure it is a bin for the target; without check unordered hex files will cause to terminate flashing
if (flash_type_target_bin && g_board_info.target_cfg) {
Expand All @@ -367,7 +366,7 @@ static bool flash_decoder_is_at_end(uint32_t addr, const uint8_t *data, uint32_t
if(end_addr == 0){ //invalid end_addr
return false;
}

}
else {
return false;
Expand Down
4 changes: 2 additions & 2 deletions source/daplink/drag-n-drop/flash_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#ifndef FLASH_DECODER_H
#define FLASH_DECODER_H

#include "stdint.h"
#include "stdbool.h"
#include <stdint.h>
#include <stdbool.h>

#include "flash_intf.h"
#include "error.h"
Expand Down
2 changes: 1 addition & 1 deletion source/daplink/drag-n-drop/flash_intf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#ifndef FLASH_INTF_H
#define FLASH_INTF_H

#include "stdint.h"
#include <stdint.h>

#include "error.h"

Expand Down
18 changes: 7 additions & 11 deletions source/daplink/drag-n-drop/flash_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@
* limitations under the License.
*/

#include "string.h"
#include "stdbool.h"

#include "flash_manager.h"
#include "util.h"
#include "macro.h"
#include "error.h"

// Set to 1 to enable debugging
Expand Down Expand Up @@ -97,7 +93,7 @@ error_t flash_manager_init(const flash_intf_t *flash_intf)
return status;
}

if (!page_erase_enabled) {
if (!page_erase_enabled) {
// Erase flash and unint if there are errors
status = intf->erase_chip();
flash_manager_printf(" intf->erase_chip ret=%i\r\n", status);
Expand Down Expand Up @@ -136,16 +132,16 @@ error_t flash_manager_data(uint32_t addr, const uint8_t *data, uint32_t size)
current_sector_valid = true;
last_addr = addr;
}

//non-increasing address support
if (ROUND_DOWN(addr, current_write_block_size) != ROUND_DOWN(last_addr, current_write_block_size)) {
if (ROUND_DOWN(addr, current_write_block_size) != ROUND_DOWN(last_addr, current_write_block_size)) {
status = flush_current_block(addr);
if (ERROR_SUCCESS != status) {
state = STATE_ERROR;
return status;
}
}

if (ROUND_DOWN(addr, current_sector_size) != ROUND_DOWN(last_addr, current_sector_size)) {
status = setup_next_sector(addr);
if (ERROR_SUCCESS != status) {
Expand Down Expand Up @@ -273,7 +269,7 @@ static bool flash_intf_valid(const flash_intf_t *flash_intf)
if (0 == flash_intf->erase_sector_size) {
return false;
}

if (0 == flash_intf->flash_busy) {
return false;
}
Expand Down Expand Up @@ -329,15 +325,15 @@ static error_t setup_next_sector(uint32_t addr)
return status;
}
}

if (page_erase_enabled) {
// Erase the current sector
status = intf->erase_sector(current_sector_addr);
flash_manager_printf(" intf->erase_sector(addr=0x%x) ret=%i\r\n", current_sector_addr);
if (ERROR_SUCCESS != status) {
intf->uninit();
return status;
}
}
}

// Clear out buffer in case block size changed
Expand Down
4 changes: 2 additions & 2 deletions source/daplink/drag-n-drop/flash_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#ifndef FLASH_MANAGER_H
#define FLASH_MANAGER_H

#include "stdint.h"
#include "stdbool.h"
#include <string.h>
#include <stdbool.h>
#include "flash_intf.h"
#include "error.h"

Expand Down
1 change: 0 additions & 1 deletion source/daplink/drag-n-drop/iap_flash_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "compiler.h"
#include "crc.h"
#include "info.h"
#include "macro.h"

// Application start must be aligned to page write
COMPILER_ASSERT(DAPLINK_ROM_APP_START % DAPLINK_MIN_WRITE_SIZE == 0);
Expand Down
6 changes: 3 additions & 3 deletions source/daplink/drag-n-drop/intelhex.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* limitations under the License.
*/

#include "string.h"
#include <string.h>

#include "intelhex.h"

Expand Down Expand Up @@ -136,7 +136,7 @@ hexfile_parse_status_t parse_hex_blob(const uint8_t *hex_blob, const uint32_t he
default:
if (low_nibble) {
line.buf[idx] |= ctoh((uint8_t)(*hex_blob)) & 0xf;
if (++idx >= (line.byte_count + 5)) { //all data in
if (++idx >= (line.byte_count + 5)) { //all data in
if (0 == validate_checksum(&line)) {
status = HEX_PARSE_CKSUM_FAIL;
goto hex_parser_exit;
Expand Down Expand Up @@ -201,7 +201,7 @@ hexfile_parse_status_t parse_hex_blob(const uint8_t *hex_blob, const uint32_t he
break;
}
}
}
}
}
} else {
if (idx < sizeof(hex_line_t)) {
Expand Down
2 changes: 1 addition & 1 deletion source/daplink/drag-n-drop/intelhex.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* @{
*/

#include "stdint.h"
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
Expand Down
5 changes: 2 additions & 3 deletions source/daplink/drag-n-drop/vfs_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* limitations under the License.
*/

#include "stdbool.h"
#include "ctype.h"
#include <ctype.h>

#include "main.h"
#include "cmsis_os2.h"
Expand Down Expand Up @@ -635,7 +634,7 @@ static void transfer_reset_file_info()
file_transfer_state = default_transfer_state;
abort_remount();
}

}

// Update the tranfer state with new information
Expand Down
4 changes: 2 additions & 2 deletions source/daplink/drag-n-drop/vfs_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#ifndef VFS_MANAGER_USER_H
#define VFS_MANAGER_USER_H

#include "stdint.h"
#include "stdbool.h"
#include <stdint.h>
#include <stdbool.h>

#include "virtual_fs.h"
#include "error.h"
Expand Down
Loading