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
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@ FunctionalState ESG_GetIntStatus(void)
*/
void ESG_IPReset(void)
{
uint32_t iprst3 = 0U;

/* Disable write protection state of SRSTIPRST */
TSB_SRST->PROTECT = SRST_PROTECT_DISABLE;

Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_TOSHIBA/TARGET_TMPM46B/analogin_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ uint16_t analogin_read_u16(analogin_t *obj)
// Start ADC conversion
ADC_Start(TSB_AD);
// Wait until AD conversion complete
while(ADC_GetConvertState(TSB_AD).Bit.NormalComplete != 1) {
while (ADC_GetConvertState(TSB_AD).Bit.NormalComplete != 1) {
// Do nothing
}
wait_us(30);
Expand Down
3 changes: 2 additions & 1 deletion targets/TARGET_TOSHIBA/TARGET_TMPM46B/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#ifndef MBED_DEVICE_H
#define MBED_DEVICE_H

#define DEVICE_ID_LENGTH 32
#define TRANSACTION_QUEUE_SIZE_SPI 4
#define DEVICE_ID_LENGTH 32

#include "objects.h"
#include <stddef.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE ; load region size_region
.ANY (+RW, +ZI)
}

ARM_LIB_STACK (0x200001E0+0x80000) EMPTY -Stack_Size { ; stack
ARM_LIB_STACK (0x20000000+0x80000) EMPTY -Stack_Size { ; stack
}
}
6 changes: 2 additions & 4 deletions targets/TARGET_TOSHIBA/TARGET_TMPM46B/device/system_TMPM46B.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,11 @@ void SystemInit(void)
volatile uint32_t oscf = 0U;
uint32_t wdte = 0U;

#if defined ( __CC_ARM )/*Enable FPU for Keil*/
#if (__FPU_USED == 1) /* __FPU_USED is defined in core_cm4.h */
#if (__FPU_USED == 1) /* __FPU_USED is defined in core_cm4.h */
/* enable FPU if available and used */
SCB->CPACR |= ((3UL << 10*2) | /* set CP10 Full Access */
(3UL << 11*2) ); /* set CP11 Full Access */
#endif
#endif
#endif

#if (WD_SETUP) /* Watchdog Setup */
while (TSB_WD->FLG != 0U) {
Expand Down
53 changes: 26 additions & 27 deletions targets/TARGET_TOSHIBA/TARGET_TMPM46B/flash_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,34 @@
#include "mbed_critical.h"
#include "tmpm46b_fc.h"

#define PROGRAM_WIRTE_MAX 16U /* Page program could be written 16 bytes/4 words once */
#define SECTOR_SIZE 0x8000 /* (512 * 8) sectors */
#define PAGE_SIZE 16U /* Page program size is 16 bytes */
#define PROGRAM_WIRTE_MAX 16U // Page program could be written 16 bytes/4 words once
#define SECTOR_SIZE 0x8000 // (512 * 8) sectors
#define PAGE_SIZE 16U // Page program size is 16 bytes

#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
#define FLASH_API_ROM ((uint32_t *)__section_begin("FLASH_CODE_ROM"))
#define SIZE_FLASH_API ((uint32_t)__section_size("FLASH_CODE_ROM"))
#define FLASH_API_RAM ((uint32_t *)__section_begin("FLASH_CODE_RAM"))
#pragma section = "FLASH_CODE_RAM"
#pragma section = "FLASH_CODE_ROM"
#endif

#if defined ( __ICCARM__ ) /* IAR Compiler */
static void Copy_Routine(uint32_t * dest, uint32_t * source, uint32_t size)
#if defined ( __ICCARM__ ) // IAR Compiler
static void Copy_Routine(uint32_t *dest, uint32_t *source, uint32_t size)
{
uint32_t *dest_addr, *source_addr, tmpsize;
uint32_t i, tmps, tmpd, mask;

dest_addr = dest;
dest_addr = dest;
source_addr = source;

tmpsize = size >> 2U;
for (i = 0U; i < tmpsize; i++) { /* 32bits copy */
for (i = 0U; i < tmpsize; i++) { // 32bits copy
*dest_addr = *source_addr;
dest_addr++;
source_addr++;
}
if (size & 0x00000003U) { /* if the last data size is not 0(maybe 1,2 or 3), copy the last data */
if (size & 0x00000003U) { // if the last data size is not 0(maybe 1,2 or 3), copy the last data
mask = 0xFFFFFF00U;
i = size & 0x00000003U;
tmps = *source_addr;
Expand All @@ -56,9 +56,9 @@ static void Copy_Routine(uint32_t * dest, uint32_t * source, uint32_t size)
}
tmps = tmps & (~mask);
tmpd = tmpd & (mask);
*dest_addr = tmps + tmpd; /* 32bits copy, but only change the bytes need to be changed */
*dest_addr = tmps + tmpd; // 32bits copy, but only change the bytes need to be changed
} else {
/* Do nothing */
// Do nothing
}
}
#endif
Expand All @@ -69,7 +69,7 @@ int32_t flash_init(flash_t *obj)
TSB_FC->PROGCR = 0x00000001U;
TSB_FC->ERASECR = 0x00000007U;
TSB_FC->AREASEL = 0x00000000U;
#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
Copy_Routine(FLASH_API_RAM, FLASH_API_ROM, SIZE_FLASH_API);
#endif
return 0;
Expand All @@ -80,36 +80,36 @@ int32_t flash_free(flash_t *obj)
return 0;
}

#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
#pragma location = "FLASH_ROM"
#endif
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
{
int status = FAIL;
/* We need to prevent flash accesses during erase operation */
// We need to prevent flash accesses during erase operation
core_util_critical_section_enter();

if (FC_SUCCESS == FC_EraseBlock(address)) {
status = SUCCESS;
} else {
/* Do nothing */
// Do nothing
}
core_util_critical_section_exit();
return status;
}

#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
#pragma location = "FLASH_ROM"
#endif
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
{
int status = SUCCESS;

/* We need to prevent flash accesses during program operation */
// We need to prevent flash accesses during program operation
core_util_critical_section_enter();
while (size > PROGRAM_WIRTE_MAX) {
if (FC_SUCCESS == FC_WritePage((uint32_t)address, (uint32_t *)data)) { /* write one page every time */
/* Do nothing */
if (FC_SUCCESS == FC_WritePage((uint32_t)address, (uint32_t *)data)) { // write one page every time
// Do nothing
} else {
status = FAIL;
break;
Expand All @@ -118,8 +118,8 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
address = address + PROGRAM_WIRTE_MAX;
data = data + PROGRAM_WIRTE_MAX;
}
if (FC_SUCCESS == FC_WritePage((uint32_t)address, (uint32_t *)data)) { /* write the last data, no more than one page */
/* Do nothing */
if (FC_SUCCESS == FC_WritePage((uint32_t)address, (uint32_t *)data)) { // write the last data, no more than one page
// Do nothing
} else {
status = FAIL;
}
Expand All @@ -128,7 +128,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
return status;
}

#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
#pragma location = "FLASH_ROM"
#endif
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
Expand All @@ -139,31 +139,31 @@ uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
return SECTOR_SIZE;
}

#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
#pragma location = "FLASH_ROM"
#endif
uint32_t flash_get_page_size(const flash_t *obj)
{
return PAGE_SIZE;
}

#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
#pragma location = "FLASH_ROM"
#endif
uint32_t flash_get_start_address(const flash_t *obj)
{
return FLASH_START_ADDR;
}

#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
#pragma location = "FLASH_ROM"
#endif
uint32_t flash_get_size(const flash_t *obj)
{
return FLASH_CHIP_SIZE;
}

#if defined ( __ICCARM__ ) /* IAR Compiler */
#if defined ( __ICCARM__ ) // IAR Compiler
#pragma location = "FLASH_ROM"
#endif
uint8_t flash_get_erase_value(const flash_t *obj)
Expand All @@ -172,4 +172,3 @@ uint8_t flash_get_erase_value(const flash_t *obj)

return 0xFF;
}

4 changes: 2 additions & 2 deletions targets/TARGET_TOSHIBA/TARGET_TMPM46B/gpio_irq_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ static gpio_irq_handler hal_irq_handler[CHANNEL_NUM] = {NULL};

static void INT_IRQHandler(PinName pin, GPIO_IRQName irq_id, uint32_t index)
{
uint32_t val;
uint32_t val;
GPIO_Port port;
uint32_t mask;
uint32_t mask;

port = (GPIO_Port)(pin >> 3);
mask = 0x01 << (pin & 0x07);
Expand Down
Loading