Skip to content

Commit 38846b2

Browse files
author
Cruz Monrreal
authored
Merge pull request #6690 from li-ho/ev-cog-bootloader
ADI: Enable bootloader for EV_COG_AD3029LZ and EV_COG_AD4050LZ
2 parents 6634e46 + e10ef5b commit 38846b2

File tree

15 files changed

+163
-80
lines changed

15 files changed

+163
-80
lines changed

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @date: $Date: $
77
*-----------------------------------------------------------------------------
88
*
9-
Copyright (c) 2010-2017 Analog Devices, Inc.
9+
Copyright (c) 2010-2018 Analog Devices, Inc.
1010
1111
All rights reserved.
1212
@@ -44,15 +44,13 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
4444
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4545
*
4646
*****************************************************************************/
47-
#include <stdint.h>
4847
#ifdef __ARMCC_VERSION
4948
#include <rt_misc.h>
5049
#endif
5150
#include <cmsis.h>
5251
#include <startup_ADuCM3029.h>
5352
#include <mbed_rtx.h>
5453

55-
5654
/*----------------------------------------------------------------------------
5755
External function Declaration
5856
*----------------------------------------------------------------------------*/
@@ -61,9 +59,8 @@ extern void SramInit(void);
6159
/*----------------------------------------------------------------------------
6260
Checksum options
6361
*----------------------------------------------------------------------------*/
64-
#if defined (__ARMCC_VERSION)
65-
__attribute__((section(".ARM.__at_0x000001A0")))
66-
#elif defined( __ICCARM__)
62+
63+
#if defined( __ICCARM__)
6764
__root
6865
#endif /* __ICCARM__ */
6966
const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @date: $Date: $
88
*-----------------------------------------------------------------------------
99
*
10-
Copyright (c) 2010-2017 Analog Devices, Inc.
10+
Copyright (c) 2010-2018 Analog Devices, Inc.
1111
1212
All rights reserved.
1313
@@ -62,6 +62,8 @@ RESET_EXCPT_HNDLR
6262
#define __STARTUP_H__
6363

6464
#define VECTOR_SECTION ".vectors"
65+
/* IVT typedefs. */
66+
typedef void( *pFunc )( void );
6567

6668
#ifdef __ARMCC_VERSION
6769
void Default_Handler(void);
@@ -71,6 +73,8 @@ void Default_Handler(void);
7173
#define RESET_EXCPT_HNDLR __main
7274
#define COMPILER_NAME "ARMCC"
7375
#define WEAK_FUNCTION(x) void x (void) __attribute__((weak, alias("Default_Handler")));
76+
extern uint32_t Load$$LR$$LR_IROM1$$Base[];
77+
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)Load$$LR$$LR_IROM1$$Base)
7478

7579
#elif defined(__ICCARM__)
7680
#pragma diag_suppress=Pm093,Pm140
@@ -80,6 +84,8 @@ void Default_Handler(void);
8084
#define RESET_EXCPT_HNDLR __iar_program_start
8185
#define COMPILER_NAME "ICCARM"
8286
#define WEAK_FUNCTION(x) WEAK_FUNC ( void x (void)) { while(1){} }
87+
#pragma section=VECTOR_SECTION
88+
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)__section_begin(VECTOR_SECTION))
8389

8490
#elif defined(__GNUC__)
8591
extern unsigned __etext;
@@ -105,8 +111,11 @@ extern int __START(void) __attribute__((noreturn)); /* main entry point */
105111
#define IVT_NAME __Vectors
106112
#define COMPILER_NAME "GNUC"
107113
#define WEAK_FUNCTION(x) void x (void) __attribute__ ((weak, alias("Default_Handler")));
114+
extern const pFunc IVT_NAME[];
115+
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)IVT_NAME)
108116
#define __STARTUP_CLEAR_BSS_MULTIPLE
109117
#endif // __GNUC__
118+
110119
#define LASTCRCPAGE 0
111120
#define BLANKX4 0xFFFFFFFF
112121
#define BLANKX20 BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4
@@ -115,8 +124,6 @@ extern int __START(void) __attribute__((noreturn)); /* main entry point */
115124
#define BLANKX60 BLANKX20,BLANKX20,BLANKX20
116125
void RESET_EXCPT_HNDLR(void);
117126
void Reset_Handler(void);
118-
/* IVT typedefs. */
119-
typedef void( *pFunc )( void );
120127

121128
#define ADUCM3029_VECTORS /* Cortex-M3 Exceptions Handler */ \
122129
Reset_Handler, /* -15 */ \

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TOOLCHAIN_ARM_STD/ADuCM3029.sct

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
#! armcc -E
12
;******************************************************************************
23
; File: ADuCM3029.sct
34
; Scatter loading file for Analog Devices ADuCM3029 processor
45
;
56
; Copyright (c) 2011 - 2014 ARM LIMITED
6-
; Copyright (c) 2016 - 2017 Analog Devices, Inc.
7+
; Copyright (c) 2016 - 2018 Analog Devices, Inc.
78
;
89
; All rights reserved.
910
; Redistribution and use in source and binary forms, with or without
@@ -32,13 +33,30 @@
3233
; Portions Copyright (c) 2017 Analog Devices, Inc.
3334
;
3435
;******************************************************************************
36+
#if !defined(MBED_APP_START)
37+
#define MBED_APP_START 0
38+
#endif
3539

36-
LR_IROM1 0x00000000 0x00040000 {
37-
ADUCM_IROM1 0x00000000 0x00040000 { ; romflash start address
40+
#if !defined(MBED_APP_SIZE)
41+
#define MBED_APP_SIZE 0x40000
42+
#endif
43+
44+
#define ADUCM_SECTOR_SIZE 0x800
45+
46+
#define ADUCM_VECTOR_SIZE 0x1A0
47+
48+
LR_IROM1 MBED_APP_START MBED_APP_SIZE {
49+
FLASH0 MBED_APP_START ADUCM_VECTOR_SIZE {
3850
*(.vectors, +First)
39-
*(.checksum)
51+
}
52+
53+
FLASH1 (MBED_APP_START + ADUCM_VECTOR_SIZE) (ADUCM_SECTOR_SIZE - ADUCM_VECTOR_SIZE) {
54+
*(.checksum, +Last)
55+
}
56+
57+
ER_IROM1 (MBED_APP_START + ADUCM_SECTOR_SIZE) (MBED_APP_SIZE - ADUCM_SECTOR_SIZE) {
4058
*(InRoot$$Sections)
41-
.ANY (+RO)
59+
*(+RO)
4260
}
4361

4462
RW_IRAM1 0x20000200 { ; data section

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TOOLCHAIN_GCC_ARM/ADuCM3029.ld

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
/*
2-
* Portions Copyright (c) 2016 - 2017 Analog Devices, Inc.
2+
* Portions Copyright (c) 2016 - 2018 Analog Devices, Inc.
33
*
44
* Based on Device/ARM/ARMCM3/Source/GCC/gcc_arm.ld file in
55
* ARM.CMSIS.4.5.0.pack.
66
*/
77

8+
#if !defined(MBED_APP_START)
9+
#define MBED_APP_START 0
10+
#endif
11+
12+
#if !defined(MBED_APP_SIZE)
13+
#define MBED_APP_SIZE 0x40000
14+
#endif
15+
16+
#define ADUCM_SECTOR_SIZE 0x800
17+
818
/* Linker script to configure memory regions. */
919
MEMORY
1020
{
11-
/* Flash bank0 */
12-
FLASH0 (rx) : ORIGIN = 0x00000000, LENGTH = 0x800
13-
/* Flash bank0 - bank127*/
14-
FLASH (rx) : ORIGIN = 0x00000800, LENGTH = 256k - 0x800
21+
/* The first 0x800 bytes of flash */
22+
FLASH0 (rx) : ORIGIN = MBED_APP_START, LENGTH = ADUCM_SECTOR_SIZE
23+
/* The rest of the flash */
24+
FLASH (rx) : ORIGIN = MBED_APP_START + ADUCM_SECTOR_SIZE, LENGTH = MBED_APP_SIZE - ADUCM_SECTOR_SIZE
1525
/* SRAM bank 0+1 */
1626
DSRAM_V (rwx) : ORIGIN = 0x20000000, LENGTH = 0x200
1727
DSRAM_A (rwx) : ORIGIN = 0x20000200, LENGTH = 16k - 0x200

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TOOLCHAIN_IAR/ADuCM3029.icf

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* ILINK Configuration File for Analog Devices ADuCM3029 processor
44
*
55
* Copyright (c) 2011 - 2014 ARM LIMITED
6-
* Copyright (c) 2016 - 2017 Analog Devices, Inc.
6+
* Copyright (c) 2016 - 2018 Analog Devices, Inc.
77
*
88
* All rights reserved.
99
* Redistribution and use in source and binary forms, with or without
@@ -29,10 +29,23 @@
2929
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3030
* POSSIBILITY OF SUCH DAMAGE.
3131
******************************************************************************/
32+
33+
if (!isdefinedsymbol(MBED_APP_START)) {
34+
define symbol MBED_APP_START = 0;
35+
}
36+
37+
if (!isdefinedsymbol(MBED_APP_SIZE)) {
38+
define symbol MBED_APP_SIZE = 0x40000;
39+
}
40+
41+
define symbol ADUCM_SECTOR_SIZE = 0x800;
42+
43+
define symbol ADUCM_VECTOR_SIZE = 0x1A0;
44+
3245
define memory mem with size = 4G;
33-
define region ROM_PAGE0_INTVEC = mem:[from 0x00000000 size 0x000001A0];
34-
define region ROM_PAGE0_CHECKSUM = mem:[from 0x000001A0 size 0x00000660];
35-
define region ROM_REGION = mem:[from 0x00000800 size 254K];
46+
define region ROM_PAGE0_INTVEC = mem:[from MBED_APP_START size ADUCM_VECTOR_SIZE];
47+
define region ROM_PAGE0_CHECKSUM = mem:[from MBED_APP_START+ADUCM_VECTOR_SIZE size ADUCM_SECTOR_SIZE-ADUCM_VECTOR_SIZE];
48+
define region ROM_REGION = mem:[from MBED_APP_START+ADUCM_SECTOR_SIZE size MBED_APP_SIZE-ADUCM_SECTOR_SIZE];
3649
define region RAM_bank1_region = mem:[from 0x20000200 size 0x00003E00];
3750
define region RAM_bank2_region = mem:[from 0x20004000 size 0x00004000]
3851
| mem:[from 0x20040000 size 0x00008000];

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/api/cmsis_nvic.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010-2017 Analog Devices, Inc.
2+
* Copyright (c) 2010-2018 Analog Devices, Inc.
33
*
44
* All rights reserved.
55
*
@@ -48,7 +48,6 @@
4848
#define NVIC_NUM_VECTORS (NVIC_USER_IRQ_OFFSET + NVIC_USER_IRQ_NUMBER)
4949

5050
#define NVIC_RAM_VECTOR_ADDRESS 0x20000000
51-
#define NVIC_FLASH_VECTOR_ADDRESS 0x0
5251

5352
#ifdef __cplusplus
5453
extern "C" {

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/api/flash_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2010-2017 Analog Devices, Inc.
2+
* Copyright (c) 2010-2018 Analog Devices, Inc.
33
*
44
* All rights reserved.
55
*
@@ -68,7 +68,7 @@ static const flash_algo_t flash_algo_config = {
6868
.erase_sector = 0x0000006F,
6969
.program_page = 0x000000AB,
7070
.static_base = 0x0000017C,
71-
.algo_blob = FLASH_ALGO
71+
.algo_blob = (uint32_t *)FLASH_ALGO
7272
};
7373

7474
static const sector_info_t sectors_info[] = {

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @date: $Date: $
77
*-----------------------------------------------------------------------------
88
*
9-
Copyright (c) 2010-2017 Analog Devices, Inc.
9+
Copyright (c) 2010-2018 Analog Devices, Inc.
1010
1111
All rights reserved.
1212
@@ -45,32 +45,29 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4545
*
4646
*****************************************************************************/
4747
#ifdef __ARMCC_VERSION
48-
#include <stdint.h>
4948
#include <rt_misc.h>
5049
#endif
5150
#include <cmsis.h>
5251
#include <startup_ADuCM4050.h>
5352
#include <mbed_rtx.h>
5453

54+
/*----------------------------------------------------------------------------
55+
External function Declaration
56+
*----------------------------------------------------------------------------*/
57+
extern void SramInit(void);
58+
5559
/*----------------------------------------------------------------------------
5660
Checksum options
5761
*----------------------------------------------------------------------------*/
58-
#if defined (__ARMCC_VERSION)
59-
__attribute__((section(".ARM.__at_0x000001A0")))
60-
#elif defined(__ICCARM__)
62+
63+
#if defined(__ICCARM__)
6164
__root
6265
#endif
6366
const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
6467
{
6568
BLANKX60,BLANKX600
6669
};
6770

68-
69-
/*----------------------------------------------------------------------------
70-
External function Declaration
71-
*----------------------------------------------------------------------------*/
72-
extern void SramInit(void);
73-
7471
/*----------------------------------------------------------------------------
7572
Exception / Interrupt Handler
7673
*----------------------------------------------------------------------------*/

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.h

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @date: $Date: $
88
*-----------------------------------------------------------------------------
99
*
10-
Copyright (c) 2010-2017 Analog Devices, Inc.
10+
Copyright (c) 2010-2018 Analog Devices, Inc.
1111
1212
All rights reserved.
1313
@@ -63,6 +63,9 @@ RESET_EXCPT_HNDLR
6363

6464
#include <adi_types.h>
6565
#define VECTOR_SECTION ".vectors"
66+
/* IVT typedefs. */
67+
typedef void( *pFunc )( void );
68+
6669
#ifdef __ARMCC_VERSION
6770
void Default_Handler(void);
6871
#define SECTION_NAME(sectionname) __attribute__((section(sectionname)))
@@ -71,6 +74,9 @@ void Default_Handler(void);
7174
#define RESET_EXCPT_HNDLR __main
7275
#define COMPILER_NAME "ARMCC"
7376
#define WEAK_FUNCTION(x) void x (void) __attribute__((weak, alias("Default_Handler")));
77+
extern uint32_t Load$$LR$$LR_IROM1$$Base[];
78+
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)Load$$LR$$LR_IROM1$$Base)
79+
7480
#elif defined(__ICCARM__)
7581
/*
7682
* IAR MISRA C 2004 error suppressions:
@@ -89,17 +95,20 @@ void Default_Handler(void);
8995
#define RESET_EXCPT_HNDLR __iar_program_start
9096
#define COMPILER_NAME "ICCARM"
9197
#define WEAK_FUNCTION(x) WEAK_FUNC ( void x (void)) { while(1){} }
98+
#pragma section=VECTOR_SECTION
99+
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)__section_begin(VECTOR_SECTION))
100+
92101
#elif defined(__GNUC__)
93-
extern unsigned __etext;
94-
extern unsigned __data_start__;
95-
extern unsigned __data_end__;
96-
extern unsigned __copy_table_start__;
97-
extern unsigned __copy_table_end__;
98-
extern unsigned __zero_table_start__;
99-
extern unsigned __zero_table_end__;
100-
extern unsigned __bss_start__;
101-
extern unsigned __bss_end__;
102-
extern unsigned __StackTop;
102+
extern uint32_t __etext;
103+
extern uint32_t __data_start__;
104+
extern uint32_t __data_end__;
105+
extern uint32_t __copy_table_start__;
106+
extern uint32_t __copy_table_end__;
107+
extern uint32_t __zero_table_start__;
108+
extern uint32_t __zero_table_end__;
109+
extern uint32_t __bss_start__;
110+
extern uint32_t __bss_end__;
111+
extern uint32_t __StackTop;
103112
void Default_Handler(void);
104113
/*----------------------------------------------------------------------------
105114
External References
@@ -112,18 +121,21 @@ extern int __START(void) __attribute__((noreturn)); /* main entry point */
112121
#define RESET_EXCPT_HNDLR __START
113122
#endif
114123
#ifndef __STACK_SIZE
115-
#define __STACK_SIZE 0x00000400
124+
#define __STACK_SIZE 0x00000400
116125
#endif
117126
#if !defined(__HEAP_SIZE) || (__HEAP_SIZE <= 0)
118-
#define __HEAP_SIZE 0x00000C00
127+
#define __HEAP_SIZE 0x00000C00
119128
#endif
120129
#define SECTION_NAME(sectionname) __attribute__ ((section(sectionname)))
121130
#define SECTION_PLACE(def,sectionname) def __attribute__ ((section(sectionname)))
122131
#define IVT_NAME __Vectors
123132
#define COMPILER_NAME "GNUC"
124133
#define WEAK_FUNCTION(x) void x (void) __attribute__ ((weak, alias("Default_Handler")));
134+
extern const pFunc IVT_NAME[];
135+
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)IVT_NAME)
125136
#define __STARTUP_CLEAR_BSS_MULTIPLE
126137
#endif // __GNUC__
138+
127139
#define LASTCRCPAGE 0
128140
#define BLANKX4 0xFFFFFFFF
129141
#define BLANKX20 BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4
@@ -132,8 +144,6 @@ extern int __START(void) __attribute__((noreturn)); /* main entry point */
132144
#define BLANKX60 BLANKX20,BLANKX20,BLANKX20
133145
void RESET_EXCPT_HNDLR(void);
134146
void Reset_Handler(void);
135-
/* IVT typedefs. */
136-
typedef void( *pFunc )( void );
137147

138148
#define ADUCM4050_VECTORS \
139149
/* Configure Initial Stack Pointer, using linker-generated symbols */\

0 commit comments

Comments
 (0)