Skip to content

Commit 5b2467f

Browse files
committed
fixed compile issue when solve merge conflict
1 parent 4b44ac4 commit 5b2467f

File tree

13 files changed

+191
-59
lines changed

13 files changed

+191
-59
lines changed

records/board/nz32_sc151.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/nz32_sc151.c
5+
source:
6+
- source/target/st/nz32_sc151/target.c
7+
- source/target/st/nz32_sc151/target_reset.c

records/board/wizwiki_w7500.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/wizwiki_w7500.c
5+
target:
6+
- source/target/wiznet/w7500/target.c
7+
- source/target/wiznet/target_reset.c

records/board/wizwiki_w7500_eco.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/wizwiki_w7500_eco.c
5+
target:
6+
- source/target/wiznet/w7500/target.c
7+
- source/target/wiznet/target_reset.c

records/board/wizwiki_w7500p.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/wizwiki_w7500p.c
5+
target:
6+
- source/target/wiznet/w7500/target.c
7+
- source/target/wiznet/target_reset.c

source/daplink/cmsis-dap/usbd_user_hid.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,6 @@ __task void hid_process(void *argv)
177177
}
178178
os_mut_release(&hid_mutex);
179179

180-
main_blink_hid_led(MAIN_LED_OFF);
180+
main_blink_hid_led(MAIN_LED_FLASH);
181181
}
182182
}

source/daplink/drag-n-drop/vfs_manager.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ void usbd_msc_write_sect(uint32_t sector, uint8_t *buf, uint32_t num_of_sectors)
349349
}
350350

351351
// indicate msc activity
352-
main_blink_msc_led(MAIN_LED_OFF);
352+
main_blink_hid_led(MAIN_LED_FLASH);
353353
vfs_write(sector, buf, num_of_sectors);
354354
if (TRASNFER_FINISHED == file_transfer_state.transfer_state) {
355355
return;

source/daplink/interface/main.c

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "board.h"
3030
#include "gpio.h"
3131
#include "uart.h"
32-
#include "serial.h"
3332
#include "tasks.h"
3433
#include "target_reset.h"
3534
#include "swd_host.h"

source/daplink/interface/target_flash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static error_t target_flash_program_page(uint32_t addr, const uint8_t *buf, uint
161161
return ERROR_SUCCESS;
162162
}
163163

164-
static error_t target_flash_erase_sector(uint32_t addr)
164+
static error_t target_flash_erase_sector(uint32_t sector)
165165
{
166166
uint32_t address = 0;
167167

source/daplink/usb2uart/usbd_user_cdc_acm.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void cdc_process_event()
146146

147147
if (len_data) {
148148
if (USBD_CDC_ACM_DataSend(data , len_data)) {
149-
main_blink_cdc_led(MAIN_LED_OFF);
149+
main_blink_cdc_led(MAIN_LED_FLASH);
150150
}
151151
}
152152

@@ -162,7 +162,7 @@ void cdc_process_event()
162162

163163
if (len_data) {
164164
if (uart_write_data(data, len_data)) {
165-
main_blink_cdc_led(MAIN_LED_OFF);
165+
main_blink_cdc_led(MAIN_LED_FLASH);
166166
}
167167
}
168168

source/hic_hal/nxp/lpc11u35/gpio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ uint8_t gpio_get_sw_reset(void)
211211
last_reset_forward_pressed = reset_forward_pressed;
212212
}
213213

214-
reset_pressed = reset_forward_pressed || (LPC_GPIO->PIN[PIN_RESET_IN_PORT] & PIN_RESET_IN ? 0 : 1);
214+
reset_pressed = reset_forward_pressed ;
215215
return !reset_pressed;
216216
}
217217

source/hic_hal/nxp/lpc11u35/iap.c

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/**
2+
* @file iap.c
3+
* @brief
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2017-2017, ARM Limited, All Rights Reserved
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
#include "iap.h"
23+
#include "cortex_m.h"
24+
#include "LPC11Uxx.h"
25+
26+
iap_operation_t iap_op;
27+
static cortex_int_state_t state;
28+
static uint32_t lock_count;
29+
30+
// taken code from the Nxp App Note AN11305
31+
/* This data must be global so it is not read from the stack */
32+
typedef void (*IAP)(uint32_t [], uint32_t []);
33+
static const IAP iap_entry = (IAP)0x1fff1ff1;
34+
#define init_msdstate() *((uint32_t *)(0x10000054)) = 0x0
35+
36+
/* This function resets some microcontroller peripherals to reset
37+
* hardware configuration to ensure that the USB In-System Programming module
38+
* will work properly. It is normally called from reset and assumes some reset
39+
* configuration settings for the MCU.
40+
* Some of the peripheral configurations may be redundant in your specific
41+
* project.
42+
*/
43+
void iap_reinvoke(void)
44+
{
45+
/* make sure USB clock is turned on before calling ISP */
46+
LPC_SYSCON->SYSAHBCLKCTRL |= 0x04000;
47+
/* make sure 32-bit Timer 1 is turned on before calling ISP */
48+
LPC_SYSCON->SYSAHBCLKCTRL |= 0x00400;
49+
/* make sure GPIO clock is turned on before calling ISP */
50+
LPC_SYSCON->SYSAHBCLKCTRL |= 0x00040;
51+
/* make sure IO configuration clock is turned on before calling ISP */
52+
LPC_SYSCON->SYSAHBCLKCTRL |= 0x10000;
53+
/* make sure AHB clock divider is 1:1 */
54+
LPC_SYSCON->SYSAHBCLKDIV = 1;
55+
/* Send Reinvoke ISP command to ISP entry point*/
56+
iap_op.cmd = 57;
57+
init_msdstate(); /* Initialize Storage state machine */
58+
/* Set stack pointer to ROM value (reset default) This must be the last
59+
* piece of code executed before calling ISP, because most C expressions
60+
* and function returns will fail after the stack pointer is changed.
61+
* In addition ensure the CONTROL register is set to 0 so the MSP is
62+
* used rather than the PSP.
63+
*/
64+
__set_MSP(*((volatile uint32_t *)0x00000000));
65+
__set_CONTROL(0);
66+
/* Enter ISP. We call "iap_entry" to enter ISP because the ISP entry is done
67+
* through the same command interface as IAP.
68+
*/
69+
iap_entry(&iap_op.cmd, &iap_op.stat);
70+
// Not supposed to come back!
71+
}
72+
73+
void iap_call(iap_operation_t *operation)
74+
{
75+
iap_entry(&operation->cmd, &operation->stat);
76+
}
77+
78+
void iap_lock()
79+
{
80+
cortex_int_state_t local_state;
81+
local_state = cortex_int_get_and_disable();
82+
if (lock_count == 0) {
83+
state = local_state;
84+
}
85+
lock_count++;
86+
}
87+
88+
void iap_unlock()
89+
{
90+
lock_count--;
91+
if (lock_count == 0) {
92+
cortex_int_restore(state);
93+
}
94+
95+
}

source/hic_hal/nxp/lpc11u35/iap.h

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* @file iap.h
3+
* @brief
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2017-2017, ARM Limited, All Rights Reserved
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
23+
#ifndef IAP_H
24+
#define IAP_H
25+
26+
#include<stdint.h>
27+
28+
#define CMD_SUCCESS 0
29+
30+
typedef struct {
31+
uint32_t cmd;
32+
uint32_t par[4];
33+
uint32_t stat;
34+
uint32_t res[4];
35+
} iap_operation_t;
36+
37+
extern iap_operation_t iap_op;
38+
39+
void iap_lock(void);
40+
void iap_unlock(void);
41+
void iap_call(iap_operation_t* operation);
42+
void iap_reinvoke(void);
43+
44+
#endif

source/hic_hal/nxp/lpc11u35/read_uid.c

+18-52
Original file line numberDiff line numberDiff line change
@@ -20,66 +20,32 @@
2020
*/
2121

2222
#include "read_uid.h"
23+
#include "iap.h"
2324

24-
#define IAP_LOCATION 0x1fff1ff1
25-
static uint32_t command[5];
26-
static uint32_t result[5];
27-
typedef void (*IAP)(uint32_t[], uint32_t[]);
28-
static IAP iap_entry;
2925

3026
void read_unique_id(uint32_t *id)
3127
{
28+
// readUID IAP call
29+
iap_lock();
3230
// readUID IAP call
33-
iap_entry = (IAP) IAP_LOCATION;
34-
command[0] = 58;
35-
__disable_irq();
36-
iap_entry(command, result);
37-
__enable_irq();
38-
// *id = result[1] ^ result[2] ^ result[3] ^ result[4];
39-
id[0] = result[1] ^ result[2];
40-
id[1] = result[3] ^ result[4];
31+
iap_op.cmd = 58;
32+
iap_call(&iap_op);
33+
34+
id[0] = iap_op.res[0] ^ iap_op.res[1];
35+
id[1] = iap_op.res[2] ^ iap_op.res[3];
36+
iap_unlock();
4137
}
4238

4339
void read_full_unique_id(uint32_t * id) {
4440
// readUID IAP call
45-
iap_entry = (IAP) IAP_LOCATION;
46-
command[0] = 58;
47-
__disable_irq();
48-
iap_entry (command, result);
49-
__enable_irq();
50-
id[0] = result[1];
51-
id[1] = result[2];
52-
id[2] = result[3];
53-
id[3] = result[4];
41+
iap_lock();
42+
// readUID IAP call
43+
iap_op.cmd = 58;
44+
iap_call(&iap_op);
45+
id[0] = iap_op.res[0];
46+
id[1] = iap_op.res[1];
47+
id[2] = iap_op.res[2];
48+
id[3] = iap_op.res[3];
49+
iap_unlock();
5450
}
5551

56-
57-
#ifdef BOARD_UBLOX_C027
58-
#include "LPC11Uxx.h"
59-
void __SVC_2(void)
60-
{
61-
// taken code from the Nxp App Note AN11305
62-
// the calls to the usb stack are removed
63-
iap_entry = (IAP) IAP_LOCATION;
64-
/* make sure USB clock is turned on before calling ISP */
65-
LPC_SYSCON->SYSAHBCLKCTRL |= 0x04000;
66-
/* make sure 32-bit Timer 1 is turned on before calling ISP */
67-
LPC_SYSCON->SYSAHBCLKCTRL |= 0x00400;
68-
/* make sure GPIO clock is turned on before calling ISP */
69-
LPC_SYSCON->SYSAHBCLKCTRL |= 0x00040;
70-
/* make sure IO configuration clock is turned on before calling ISP */
71-
LPC_SYSCON->SYSAHBCLKCTRL |= 0x10000;
72-
/* make sure AHB clock divider is 1:1 */
73-
LPC_SYSCON->SYSAHBCLKDIV = 1;
74-
/* Send Reinvoke ISP command to ISP entry point*/
75-
command[0] = 57;
76-
/* Set stack pointer to ROM value (reset default) This must be the last
77-
piece of code executed before calling ISP, because most C expressions
78-
and function returns will fail after the stack pointer is changed. */
79-
__set_MSP(*((uint32_t *)0x00000000));
80-
/* Enter ISP. We call "iap_entry" to enter ISP because the ISP entry is done
81-
through the same command interface as IAP. */
82-
iap_entry(command, result);
83-
// Not supposed to come back!
84-
}
85-
#endif

0 commit comments

Comments
 (0)