diff --git a/core/driver/blockio.c b/core/driver/blockio.c index 69966a3..897143d 100644 --- a/core/driver/blockio.c +++ b/core/driver/blockio.c @@ -28,6 +28,12 @@ The OS block device implementations operate on sectors. The core does I/O in terms of logical blocks: this module translates from logical blocks to sectors. + + If bBlockIoRetries is greater than 0 for the current volume, then this + module will retry block device calls on failure up to the configured number + of times. This behavior caters to the type of unreliable hardware and + drivers that are sometimes found in the IoT world, where one operation may + fail but the next may still succeed. */ #include #include @@ -52,7 +58,7 @@ REDSTATUS RedIoRead( uint32_t ulBlockCount, void *pBuffer) { - REDSTATUS ret; + REDSTATUS ret = 0; if( (bVolNum >= REDCONF_VOLUME_COUNT) || (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount) @@ -68,11 +74,20 @@ REDSTATUS RedIoRead( uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift; uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift; uint32_t ulSectorCount = ulBlockCount << bSectorShift; + uint8_t bRetryIdx; REDASSERT(bSectorShift < 32U); REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount); - ret = RedOsBDevRead(bVolNum, ullSectorStart, ulSectorCount, pBuffer); + for(bRetryIdx = 0U; bRetryIdx <= gpRedVolConf->bBlockIoRetries; bRetryIdx++) + { + ret = RedOsBDevRead(bVolNum, ullSectorStart, ulSectorCount, pBuffer); + + if(ret == 0) + { + break; + } + } } CRITICAL_ASSERT(ret == 0); @@ -101,7 +116,7 @@ REDSTATUS RedIoWrite( uint32_t ulBlockCount, const void *pBuffer) { - REDSTATUS ret; + REDSTATUS ret = 0; if( (bVolNum >= REDCONF_VOLUME_COUNT) || (ulBlockStart >= gaRedVolume[bVolNum].ulBlockCount) @@ -117,11 +132,20 @@ REDSTATUS RedIoWrite( uint8_t bSectorShift = gaRedVolume[bVolNum].bBlockSectorShift; uint64_t ullSectorStart = (uint64_t)ulBlockStart << bSectorShift; uint32_t ulSectorCount = ulBlockCount << bSectorShift; + uint8_t bRetryIdx; REDASSERT(bSectorShift < 32U); REDASSERT((ulSectorCount >> bSectorShift) == ulBlockCount); - ret = RedOsBDevWrite(bVolNum, ullSectorStart, ulSectorCount, pBuffer); + for(bRetryIdx = 0U; bRetryIdx <= gpRedVolConf->bBlockIoRetries; bRetryIdx++) + { + ret = RedOsBDevWrite(bVolNum, ullSectorStart, ulSectorCount, pBuffer); + + if(ret == 0) + { + break; + } + } } CRITICAL_ASSERT(ret == 0); @@ -144,7 +168,7 @@ REDSTATUS RedIoWrite( REDSTATUS RedIoFlush( uint8_t bVolNum) { - REDSTATUS ret; + REDSTATUS ret = 0; if(bVolNum >= REDCONF_VOLUME_COUNT) { @@ -153,7 +177,17 @@ REDSTATUS RedIoFlush( } else { - ret = RedOsBDevFlush(bVolNum); + uint8_t bRetryIdx; + + for(bRetryIdx = 0U; bRetryIdx <= gpRedVolConf->bBlockIoRetries; bRetryIdx++) + { + ret = RedOsBDevFlush(bVolNum); + + if(ret == 0) + { + break; + } + } } CRITICAL_ASSERT(ret == 0); diff --git a/core/driver/buffer.c b/core/driver/buffer.c index 0ebe4c7..17717e0 100644 --- a/core/driver/buffer.c +++ b/core/driver/buffer.c @@ -311,7 +311,7 @@ REDSTATUS RedBufferGet( mounted; that condition is expected and should not result in an assertion. */ - CRITICAL_ASSERT((uFlags & BFLAG_META_MASTER) != 0U); + CRITICAL_ASSERT((uFlags & BFLAG_META_MASTER) == BFLAG_META_MASTER); ret = -RED_EIO; } } diff --git a/doc/release_notes.md b/doc/release_notes.md index 9e90443..403f6be 100644 --- a/doc/release_notes.md +++ b/doc/release_notes.md @@ -5,6 +5,30 @@ recent releases and a list of known issues. ## Release History and Changes +### Reliance Edge v1.0.2, February 2016 + +#### Common Code Changes +- A new per-volume configuration option has been added: users can specify a + number of times to retry a block device read, write or flush operation before + returning a failure. The configuration tool has been updated to version 1.0.2 + with this change. + - This added a new field to the volume configuration in to redconf.c: existing + redconf.c files from v1.0.1 and earlier must be updated to work with v1.0.2. + Open redconf.h and redconf.c with the configuration tool, enable + "Retry block device I/O on failure" for any volumes if desired, and save the + redconf files. + +#### FreeRTOS Port Changes +- Added support for the STM32 HAL SD card driver in the FreeRTOS block device + interface. Two boards are supported out-of-the-box: the STM324xG-EVAL and the + STM32F746NG-Discovery. A sample project is included for the STM324xG-EVAL. + +#### MQX Port Changes +- Fixed a bug which prevented Reliance Edge from compiling if the File System + Essentials API was selected in the configuration. +- Fixed a bug which would have returned an uninitialized value from + `RedOsBDevFlush()` for block devices that support flushing. + ### Reliance Edge v1.0.1, October 2015 - Added MQX RTOS support in the commercial kit, with example projects for diff --git a/doc/release_notes.txt b/doc/release_notes.txt index f469125..fd51a83 100644 --- a/doc/release_notes.txt +++ b/doc/release_notes.txt @@ -9,6 +9,34 @@ course of recent releases and a list of known issues. Release History and Changes +Reliance Edge v1.0.2, February 2016 + +Common Code Changes + +- A new per-volume configuration option has been added: users can + specify a number of times to retry a block device read, write or + flush operation before returning a failure. The configuration tool + has been updated to version 1.0.2 with this change. +- This added a new field to the volume configuration in to redconf.c: + existing redconf.c files from v1.0.1 and earlier must be updated to + work with v1.0.2. Open redconf.h and redconf.c with the + configuration tool, enable "Retry block device I/O on failure" for + any volumes if desired, and save the redconf files. + +FreeRTOS Port Changes + +- Added support for the STM32 HAL SD card driver in the FreeRTOS block + device interface. Two boards are supported out-of-the-box: the + STM324xG-EVAL and the STM32F746NG-Discovery. A sample project is + included for the STM324xG-EVAL. + +MQX Port Changes + +- Fixed a bug which prevented Reliance Edge from compiling if the File + System Essentials API was selected in the configuration. +- Fixed a bug which would have returned an uninitialized value from + RedOsBDevFlush() for block devices that support flushing. + Reliance Edge v1.0.1, October 2015 - Added MQX RTOS support in the commercial kit, with example projects diff --git a/include/redver.h b/include/redver.h index 89eed9e..1985a20 100644 --- a/include/redver.h +++ b/include/redver.h @@ -33,7 +33,7 @@ */ -#define RED_BUILD_NUMBER "668" +#define RED_BUILD_NUMBER "670" #define RED_KIT_GPL 0U /* Open source GPL kit. */ #define RED_KIT_COMMERCIAL 1U /* Commercially-licensed kit. */ @@ -48,7 +48,7 @@ /** @brief Version number to display in output. */ -#define RED_VERSION "v1.0.1" +#define RED_VERSION "v1.0.2" /** @brief On-disk version number. diff --git a/include/redvolume.h b/include/redvolume.h index 2241db6..266cf5e 100644 --- a/include/redvolume.h +++ b/include/redvolume.h @@ -62,6 +62,13 @@ typedef struct */ uint32_t ulInodeCount; + /** This is the maximum number of times a block device I/O operation will + be retried. If a block device read, write, or flush fails, Reliance + Edge will try again up to this number of times until the operation is + successful. Set this to 0 to disable retries. + */ + uint8_t bBlockIoRetries; + #if REDCONF_API_POSIX == 1 /** The path prefix for the volume; for example, "VOL1:", "FlashDisk", etc. */ diff --git a/os/freertos/include/redosdeviations.h b/os/freertos/include/redosdeviations.h index 5fe6a8d..cfde3a7 100644 --- a/os/freertos/include/redosdeviations.h +++ b/os/freertos/include/redosdeviations.h @@ -36,8 +36,7 @@ #endif -#if REDCONF_ASSERTS == 1 -#if REDCONF_OUTPUT == 1 +#if (REDCONF_ASSERTS == 1) && (REDCONF_OUTPUT == 1) /** Print a formatted message for an assertion. Usages of this macro deviate from MISRA C:2012 Rule 21.6 (required). Using @@ -50,11 +49,8 @@ As Rule 21.6 is required, a separate deviation record is required. */ #define PRINT_ASSERT(file, line) \ - (void)printf("Assertion failed in \"%s\" at line %u\n\r", ((file) == NULL) ? "" : (file), (unsigned)(line)) -#else -#define PRINT_ASSERT(file, line) do { (void)(file); (void)(line); } while(false) -#endif /* REDCONF_OUTPUT == 1 */ -#endif /* REDCONF_ASSERTS == 1 */ + printf("Assertion failed in \"%s\" at line %u\n\r", ((file) == NULL) ? "" : (file), (unsigned)(line)) +#endif /** Cast a value to unsigned long. @@ -161,5 +157,88 @@ #endif +/** Ignore the return value of a function (cast to void) + + Usages of this macro deviate from MISRA C:2012 Directive 4.7, which states + that error information must be checked immediately after a function returns + potential error information. + + If asserts and output are enabled, then this macro is used to document that + the return value of printf() is ignored. A failure of printf() does not + impact the filesystem core, nor is there anything the filesystem can do to + respond to such an error (especially since it occurs within an assert). + Thus, the most reasonable action is to ignore the error. + + In the STM32 SDIO block device implementation, errors are also ignored in an + IRQ interrupt handler. This is the most reasonable action to take for two + reasons: (a) it would be dangerous to spend processor time responding to the + error inside the IRQ handler; (b) it has been verified that the same error + is propegated to the DiskRead/Write method, which does return the error to + the core. + + In the Atmel SD/MMC block device implementation, error information from + sd_mmc_read_capacity() is ignored. This is a reasonable action because all + of the possible error conditions were eliminated by a previous check. + sd_mmc_read_capacity() fails under the same conditions as + sd_mmc_test_unit_ready(), which was checked ealier in the same function. + + In the mutex module, error information returned from the mutex release + function is ignored when asserts are disabled. This is a reasonable action + because the mutex release function (xSemaphoreGive) is documented only to + fail if the mutex was not obtained correctly, which can be demonstrably + avoided. + + As Directive 4.7 is required, a separate deviation record is required. +*/ +#define IGNORE_ERRORS(fn) ((void) (fn)) + + +/** @brief Determine whether a pointer is aligned on a 32-bit boundary. + + This is used to determine whether a data buffer meets the requirements of + the underlying block device implementation. When transferring data via + DMA (Direct Memory Access) on an STM32 device, the data buffer must be cast + as a uint32 pointer, and unexpected behavior may occur if the buffer is not + aligned correctly. + + There is no way to perform this check without deviating from MISRA C rules + against casting pointers to integer types. Usage of this macro deviates + from MISRA C:2012 Rule 11.4 (advisory). The main rationale the rule cites + against converting pointers to integers is that the chosen integer type may + not be able to represent the pointer; this is a non-issue here since we use + uintptr_t. The text says the rule still applies when using uintptr_t due to + concern about unaligned pointers, but that is not an issue here since the + integer value of the pointer is not saved and not converted back into a + pointer and dereferenced. The result of casting a pointer to a sufficiently + large integer is implementation-defined, but macros similar to this one have + been used by Datalight for a long time in a wide variety of environments and + they have always worked as expected. + + This deviation only occurs when using the STM32 SDIO block device + implementation. + + As Rule 11.4 is advisory, a deviation record is not required. This notice + is the only record of deviation. +*/ +#define IS_UINT32_ALIGNED_PTR(ptr) (((uintptr_t)(ptr) & (sizeof(uint32_t) - 1U)) == 0U) + + +/** @brief Cast a 32-bit aligned void pointer to a uint32 pointer. + + Usages of this macro deviate from MISRA C:2012 Rule 11.5 (advisory). A + cast from a void pointer to an object pointer is discouraged because of + potential alignment issues. However, this macro is only used to cast + pointers that have already been tested to be 32-bit aligned, so the + operation will be safe. + + This deviation only occurs when using the STM32 SDIO block device + implementation. + + As rule 11.5 is advisory, a deviation record is not required. This notice + is the only record of the deviation. +*/ +#define CAST_UINT32_PTR(ptr) ((uint32_t *) (ptr)) + + #endif diff --git a/os/freertos/services/osassert.c b/os/freertos/services/osassert.c index d5364fa..9822caf 100644 --- a/os/freertos/services/osassert.c +++ b/os/freertos/services/osassert.c @@ -43,7 +43,9 @@ void RedOsAssertFail( const char *pszFileName, uint32_t ulLineNum) { - PRINT_ASSERT(pszFileName, ulLineNum); + #if REDCONF_OUTPUT == 1 + IGNORE_ERRORS(PRINT_ASSERT(pszFileName, ulLineNum)); + #endif while(true) { diff --git a/os/freertos/services/osbdev.c b/os/freertos/services/osbdev.c index 86a489d..0d7a5b9 100644 --- a/os/freertos/services/osbdev.c +++ b/os/freertos/services/osbdev.c @@ -54,7 +54,7 @@ multi-sector requests, and servicing these one sector at a time will significantly slow down the file system. */ -#define BDEV_F_DRIVER 0U +#define BDEV_F_DRIVER (0U) /** @brief The FatFs example implementation. @@ -63,7 +63,7 @@ in and used immediately. The FatFs `diskio.h` header must be in the include directory path. */ -#define BDEV_FATFS 1U +#define BDEV_FATFS (1U) /** @brief The Atmel Studio Framework SD/MMC driver example implementation. @@ -83,7 +83,15 @@ advantages to issuing real multi-sector requests, so using the modified driver is recommended. */ -#define BDEV_ATMEL_SDMMC 2U +#define BDEV_ATMEL_SDMMC (2U) + +/** @brief The ST Microelectronics STM32 SDIO driver example implementation. + + This implementation accesses the microSD card through the BSP utilities + provided as part of the STM32Cube package, used with the STM32 HAL drivers. + The STM3240G-EVAL and STM32F746NG-Discovery boards are currently supported. +*/ +#define BDEV_STM32_SDIO (3U) /** @brief The RAM disk example implementation. @@ -92,7 +100,7 @@ target hardware, the amount of spare RAM will be limited so generally only very small disks will be available. */ -#define BDEV_RAM_DISK 3U +#define BDEV_RAM_DISK (4U) /** @brief Pick which example implementation is compiled. @@ -100,6 +108,7 @@ - #BDEV_F_DRIVER - #BDEV_FATFS - #BDEV_ATMEL_SDMMC + - #BDEV_STM32_SDIO - #BDEV_RAM_DISK */ #define BDEV_EXAMPLE_IMPLEMENTATION BDEV_ATMEL_SDMMC @@ -868,7 +877,7 @@ static REDSTATUS DiskOpen( { uint32_t ulSectorLast; - (void)sd_mmc_read_capacity(bVolNum, &ulSectorLast); + IGNORE_ERRORS(sd_mmc_read_capacity(bVolNum, &ulSectorLast)); /* The ASF SD/MMC driver only supports 512-byte sectors. */ @@ -1027,6 +1036,337 @@ static REDSTATUS DiskFlush( } #endif /* REDCONF_READ_ONLY == 0 */ +#elif BDEV_EXAMPLE_IMPLEMENTATION == BDEV_STM32_SDIO + +#ifdef USE_STM324xG_EVAL + #include + #include +#elif defined(USE_STM32746G_DISCO) + #include + #include +#else + /* If you are using a compatible STM32 device other than the two listed above + and you have SD card driver headers, you can try adding them to the above + list. + */ + #error "Unsupported device." +#endif + +#if REDCONF_VOLUME_COUNT > 1 + #error "The STM32 SDIO block device implementation does not support multiple volumes." +#endif + + +#ifndef USE_HAL_DRIVER + #error "The STM32 StdPeriph driver is not supported. Please use the HAL driver or modify the Reliance Edge block device interface." +#endif + +/** @brief Number of times to call BSP_SD_GetStatus() before timing out and + returning an error. + + See ::CheckStatus(). + + NOTE: Datalight has not observed a scenario where BSP_SD_GetStatus() + returns SD_TRANSFER_BUSY after a transfer command returns successfully. + Set SD_STATUS_TIMEOUT to 0U to skip checking BSP_SD_GetStatus(). +*/ +#define SD_STATUS_TIMEOUT (100000U) + +/** @brief 4-byte aligned buffer to use for DMA transfers when passed in + an unaligned buffer. +*/ +static uint32_t gaulAlignedBuffer[512U / sizeof(uint32_t)]; + + +#if SD_STATUS_TIMEOUT > 0U +static REDSTATUS CheckStatus(void); +#endif + + +/** @brief Initialize a disk. + + @param bVolNum The volume number of the volume whose block device is being + initialized. + @param mode The open mode, indicating the type of access required. + + @return A negated ::REDSTATUS code indicating the operation result. + + @retval 0 Operation was successful. + @retval -RED_EIO No SD card was found; or BSP_SD_Init() failed. + @retval -RED_EINVAL The SD card's block size is not the same as the + configured sector size; or the SD card is not large + enough for the volume; or the volume size is above + 4GiB, meaning that part of it cannot be accessed + through the STM32 SDIO driver. +*/ +static REDSTATUS DiskOpen( + uint8_t bVolNum, + BDEVOPENMODE mode) +{ + REDSTATUS ret = 0; + static bool fSdInitted = false; + + (void) mode; + + if(!fSdInitted) + { + if(BSP_SD_Init() == MSD_OK) + { + fSdInitted = true; + } + } + + if(!fSdInitted) + { + /* Above initialization attempt failed. + */ + ret = -RED_EIO; + } + else if(BSP_SD_IsDetected() == SD_NOT_PRESENT) + { + ret = -RED_EIO; + } + else + { + uint32_t ulSectorSize = gaRedVolConf[bVolNum].ulSectorSize; + HAL_SD_CardInfoTypedef sdCardInfo = {{0}}; + + BSP_SD_GetCardInfo(&sdCardInfo); + + /* Note: the actual card block size is sdCardInfo.CardBlockSize, + but the interface only supports a 512 byte block size. Further, + one card has been observed to report a 1024-byte block size, + but it worked fine with a 512-byte Reliance Edge ulSectorSize. + */ + if( (ulSectorSize != 512U) + || (sdCardInfo.CardCapacity < (gaRedVolConf[bVolNum].ullSectorCount * ulSectorSize))) + { + ret = -RED_EINVAL; + } + } + + return ret; +} + + +/** @brief Uninitialize a disk. + + @param bVolNum The volume number of the volume whose block device is being + uninitialized. + + @return A negated ::REDSTATUS code indicating the operation result. + + @retval 0 Operation was successful. +*/ +static REDSTATUS DiskClose( + uint8_t bVolNum) +{ + (void)bVolNum; + return 0; +} + + +/** @brief Read sectors from a disk. + + @param bVolNum The volume number of the volume whose block device + is being read from. + @param ullSectorStart The starting sector number. + @param ulSectorCount The number of sectors to read. + @param pBuffer The buffer into which to read the sector data. + + @return A negated ::REDSTATUS code indicating the operation result. + + @retval 0 Operation was successful. + @retval -RED_EIO A disk I/O error occurred. +*/ +static REDSTATUS DiskRead( + uint8_t bVolNum, + uint64_t ullSectorStart, + uint32_t ulSectorCount, + void *pBuffer) +{ + REDSTATUS redStat = 0; + uint32_t ulSectorSize = gaRedVolConf[bVolNum].ulSectorSize; + uint8_t bSdError; + + if(IS_UINT32_ALIGNED_PTR(pBuffer)) + { + bSdError = BSP_SD_ReadBlocks_DMA(CAST_UINT32_PTR(pBuffer), ullSectorStart * ulSectorSize, ulSectorSize, ulSectorCount); + + if(bSdError != MSD_OK) + { + redStat = -RED_EIO; + } + #if SD_STATUS_TIMEOUT > 0U + else + { + redStat = CheckStatus(); + } + #endif + } + else + { + uint32_t ulSectorIdx; + + for(ulSectorIdx = 0U; ulSectorIdx < ulSectorCount; ulSectorIdx++) + { + bSdError = BSP_SD_ReadBlocks_DMA(gaulAlignedBuffer, (ullSectorStart + ulSectorIdx) * ulSectorSize, ulSectorSize, 1U); + + if(bSdError != MSD_OK) + { + redStat = -RED_EIO; + } + #if SD_STATUS_TIMEOUT > 0U + else + { + redStat = CheckStatus(); + } + #endif + + if(redStat == 0) + { + uint8_t *pbBuffer = CAST_VOID_PTR_TO_UINT8_PTR(pBuffer); + + RedMemCpy(&pbBuffer[ulSectorIdx * ulSectorSize], gaulAlignedBuffer, ulSectorSize); + } + else + { + break; + } + } + } + + return redStat; +} + + +#if REDCONF_READ_ONLY == 0 +/** @brief Write sectors to a disk. + + @param bVolNum The volume number of the volume whose block device + is being written to. + @param ullSectorStart The starting sector number. + @param ulSectorCount The number of sectors to write. + @param pBuffer The buffer from which to write the sector data. + + @return A negated ::REDSTATUS code indicating the operation result. + + @retval 0 Operation was successful. + @retval -RED_EIO A disk I/O error occurred. +*/ +static REDSTATUS DiskWrite( + uint8_t bVolNum, + uint64_t ullSectorStart, + uint32_t ulSectorCount, + const void *pBuffer) +{ + REDSTATUS redStat = 0; + uint32_t ulSectorSize = gaRedVolConf[bVolNum].ulSectorSize; + uint8_t bSdError; + + if(IS_UINT32_ALIGNED_PTR(pBuffer)) + { + bSdError = BSP_SD_WriteBlocks_DMA(CAST_UINT32_PTR(CAST_AWAY_CONST(void, pBuffer)), ullSectorStart * ulSectorSize, + ulSectorSize, ulSectorCount); + + if(bSdError != MSD_OK) + { + redStat = -RED_EIO; + } + #if SD_STATUS_TIMEOUT > 0U + else + { + redStat = CheckStatus(); + } + #endif + } + else + { + uint32_t ulSectorIdx; + + for(ulSectorIdx = 0U; ulSectorIdx < ulSectorCount; ulSectorIdx++) + { + const uint8_t *pbBuffer = CAST_VOID_PTR_TO_CONST_UINT8_PTR(pBuffer); + + RedMemCpy(gaulAlignedBuffer, &pbBuffer[ulSectorIdx * ulSectorSize], ulSectorSize); + + bSdError = BSP_SD_WriteBlocks_DMA(gaulAlignedBuffer, (ullSectorStart + ulSectorIdx) * ulSectorSize, ulSectorSize, 1U); + + if(bSdError != MSD_OK) + { + redStat = -RED_EIO; + } + #if SD_STATUS_TIMEOUT > 0U + else + { + redStat = CheckStatus(); + } + #endif + + if(redStat != 0) + { + break; + } + } + } + + return redStat; +} + + +/** @brief Flush any caches beneath the file system. + + @param bVolNum The volume number of the volume whose block device is being + flushed. + + @return A negated ::REDSTATUS code indicating the operation result. + + @retval 0 Operation was successful. +*/ +static REDSTATUS DiskFlush( + uint8_t bVolNum) +{ + /* Disk transfer is synchronous; nothing to flush. + */ + (void) bVolNum; + return 0; +} + + +#if SD_STATUS_TIMEOUT > 0U +/** @brief Wait until BSP_SD_GetStatus returns SD_TRANSFER_OK. + + This function calls BSP_SD_GetStatus repeatedly as long as it returns + SD_TRANSFER_BUSY up to SD_STATUS_TIMEOUT times. + + @return A negated ::REDSTATUS code indicating the operation result. + + @retval 0 SD_TRANSFER_OK was returned. + @retval -RED_EIO SD_TRANSFER_ERROR received, or timed out waiting for + SD_TRANSFER_OK. +*/ +static REDSTATUS CheckStatus(void) +{ + REDSTATUS redStat = 0; + uint32_t ulTimeout = SD_STATUS_TIMEOUT; + HAL_SD_TransferStateTypedef transferState; + + do + { + transferState = BSP_SD_GetStatus(); + ulTimeout--; + } while((transferState == SD_TRANSFER_BUSY) && (ulTimeout > 0U)); + + if(transferState != SD_TRANSFER_OK) + { + redStat = -RED_EIO; + } + + return redStat; +} +#endif + +#endif /* REDCONF_READ_ONLY == 0 */ #elif BDEV_EXAMPLE_IMPLEMENTATION == BDEV_RAM_DISK @@ -1204,7 +1544,6 @@ static REDSTATUS DiskFlush( } #endif /* REDCONF_READ_ONLY == 0 */ - #else #error "Invalid BDEV_EXAMPLE_IMPLEMENTATION value" diff --git a/os/freertos/services/osmutex.c b/os/freertos/services/osmutex.c index f617949..f4b27d0 100644 --- a/os/freertos/services/osmutex.c +++ b/os/freertos/services/osmutex.c @@ -29,6 +29,7 @@ #include #include +#include #if REDCONF_TASK_COUNT > 1U @@ -113,7 +114,7 @@ void RedOsMutexRelease(void) xSuccess = xSemaphoreGive(xMutex); REDASSERT(xSuccess == pdTRUE); - (void)xSuccess; + IGNORE_ERRORS(xSuccess); } #endif diff --git a/os/win32/build/host.mk b/os/win32/build/host.mk index 5a27145..91f5999 100644 --- a/os/win32/build/host.mk +++ b/os/win32/build/host.mk @@ -12,8 +12,10 @@ INCLUDES= \ EXTRA_CFLAGS += /W3 /D_CRT_SECURE_NO_WARNINGS ifeq ($(B_DEBUG),0) EXTRA_CFLAGS += /O2 /Ot /Ox +LDFLAGS = else EXTRA_CFLAGS += /Od /D_DEBUG /MTd /Od /Zi /RTC1 +LDFLAGS = /DEBUG endif all: redfmt redimgbld @@ -55,10 +57,10 @@ $(P_PROJDIR)/redconf.$(B_OBJEXT): $(P_CONFDIR)/redconf.c redfmt: $(P_BASEDIR)/os/win32/tools/winfmt.$(B_OBJEXT) $(P_BASEDIR)/os/win32/tools/wintlcmn.$(B_OBJEXT) $(REDDRIVOBJ) $(REDTOOLOBJ) - $(LD) /OUT:$@.exe $^ + $(LD) $(LDFLAGS) /OUT:$@.exe $^ redimgbld: $(IMGBLDOBJ) $(REDDRIVOBJ) $(REDTOOLOBJ) - $(LD) /OUT:$@.exe $^ + $(LD) $(LDFLAGS) /OUT:$@.exe $^ .phony: clean clean: diff --git a/os/win32/tools/config/include/version.h b/os/win32/tools/config/include/version.h index abc2d99..50de910 100644 --- a/os/win32/tools/config/include/version.h +++ b/os/win32/tools/config/include/version.h @@ -25,7 +25,7 @@ #ifndef VERSION_H #define VERSION_H -#define CONFIG_VERSION "1.0" +#define CONFIG_VERSION "1.0.2" #endif // VERSION_H diff --git a/os/win32/tools/config/ui/configwindow.cpp b/os/win32/tools/config/ui/configwindow.cpp index 1dc478e..6747eba 100644 --- a/os/win32/tools/config/ui/configwindow.cpp +++ b/os/win32/tools/config/ui/configwindow.cpp @@ -138,6 +138,9 @@ ConfigWindow::ConfigWindow(QWidget *parent) : ui->labelVolSizeBytes, ui->sbInodeCount, ui->cmbAtomicWrite, + ui->cbEnableRetries, + ui->sbBlockIoRetries, + ui->widgetBlockIoRetries, ui->btnAddVol, ui->btnRemoveCurrVol, ui->listVolumes, @@ -146,7 +149,8 @@ ConfigWindow::ConfigWindow(QWidget *parent) : ui->wbtnSectorSize, ui->wbtnVolSize, ui->wbtnInodeCount, - ui->wbtnAtomicWrite); + ui->wbtnAtomicWrite, + ui->wbtnIoRetries); wbtns.append(ui->wbtnTransactVolFull); wbtns.append(ui->wbtnTransactManual); diff --git a/os/win32/tools/config/ui/configwindow.ui b/os/win32/tools/config/ui/configwindow.ui index 33b2ee6..f43afbc 100644 --- a/os/win32/tools/config/ui/configwindow.ui +++ b/os/win32/tools/config/ui/configwindow.ui @@ -68,8 +68,8 @@ 0 0 - 345 - 614 + 350 + 681 @@ -873,7 +873,7 @@ 0 0 - 362 + 364 504 @@ -1435,6 +1435,150 @@ + + + + 0 + + + + + + + Retry block device I/O on failure + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Maximum retries: + + + + + + + + 1 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + 1 + + + 255 + + + 2 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 18 + 16777215 + + + + + + + + + @@ -1541,8 +1685,8 @@ 0 0 - 362 - 504 + 292 + 364 @@ -2093,8 +2237,8 @@ 0 0 - 362 - 504 + 221 + 473 @@ -2463,8 +2607,8 @@ 0 0 - 362 - 504 + 212 + 415 @@ -2713,8 +2857,8 @@ 0 0 - 362 - 504 + 271 + 472 @@ -2914,7 +3058,7 @@ 0 0 370 - 21 + 20 diff --git a/os/win32/tools/config/validators.cpp b/os/win32/tools/config/validators.cpp index cb5d180..fb85195 100644 --- a/os/win32/tools/config/validators.cpp +++ b/os/win32/tools/config/validators.cpp @@ -269,6 +269,20 @@ Validity validateBlockSize(unsigned long value, QString &msg) return Valid; } +/// +/// \brief Validator for allSettings::sbsBlockIoRetries +/// +Validity validateVolIoRetries(unsigned long value, QString &msg) +{ + if(value > 254) + { + msg = "Block I/O retries cannot be higher than 254."; + return Invalid; + } + + return Valid; +} + /// /// \brief Validator for the number of volumes added in the Volumes tab /// diff --git a/os/win32/tools/config/validators.h b/os/win32/tools/config/validators.h index 7f63d32..680649f 100644 --- a/os/win32/tools/config/validators.h +++ b/os/win32/tools/config/validators.h @@ -47,6 +47,7 @@ Validity validateTaskCount(unsigned long value, QString &msg); Validity validateHandleCount(unsigned long value, QString &msg); Validity validateBlockSize(unsigned long value, QString &msg); +Validity validateVolIoRetries(unsigned long value, QString &msg); Validity validateVolumeCount(unsigned long value, QString &msg); Validity validateVolName(QString value, QString &msg); diff --git a/os/win32/tools/config/volumesettings.cpp b/os/win32/tools/config/volumesettings.cpp index d8ad2a0..3cee0b4 100644 --- a/os/win32/tools/config/volumesettings.cpp +++ b/os/win32/tools/config/volumesettings.cpp @@ -36,12 +36,14 @@ VolumeSettings::Volume::Volume(QString name, WarningBtn *wbtnSectorSize, WarningBtn *wbtnVolSize, WarningBtn *wbtnInodeCount, - WarningBtn *wbtnAtomicWrite) + WarningBtn *wbtnAtomicWrite, + WarningBtn *wbtnBlockIoRetries) : stName("", name, validateVolName, wbtnPathPrefix), stSectorSize("", 512, validateVolSectorSize, wbtnSectorSize), stSectorCount("", 1024, validateVolSectorCount, wbtnVolSize), stInodeCount("", 100, validateVolInodeCount, wbtnInodeCount), - stAtomicWrite("", gpszAtomicWrFalse, validateVolAtomicWrite, wbtnAtomicWrite) + stAtomicWrite("", gpszAtomicWrFalse, validateVolAtomicWrite, wbtnAtomicWrite), + stBlockIoRetries("", 0, validateVolIoRetries, wbtnBlockIoRetries) { Q_ASSERT(allSettings.sbsAllocatedBuffers != NULL); stSectorCount.notifyList.append(allSettings.sbsAllocatedBuffers); @@ -75,6 +77,12 @@ StrSetting *VolumeSettings::Volume::GetStAtomicWrite() return &stAtomicWrite; } +IntSetting *VolumeSettings::Volume::GetStBlockIoRetries() +{ + return &stBlockIoRetries; +} + + bool VolumeSettings::Volume::NeedsExternalImap() { // Formulas taken from RedCoreInit @@ -109,6 +117,9 @@ VolumeSettings::VolumeSettings(QLineEdit *pathPrefixBox, QLabel *volSizeLabel, QSpinBox *inodeCountBox, QComboBox *atomicWriteBox, + QCheckBox *enableRetriesCheck, + QSpinBox *numRetriesBox, + QWidget *numRetriesWidget, QPushButton *addButton, QPushButton *removeButton, QListWidget *volumesList, @@ -117,7 +128,8 @@ VolumeSettings::VolumeSettings(QLineEdit *pathPrefixBox, WarningBtn *sectorSizeWarn, WarningBtn *volSizeWarn, WarningBtn *inodeCountWarn, - WarningBtn *atomicWriteWarn) + WarningBtn *atomicWriteWarn, + WarningBtn *ioRetriesWarn) : stVolumeCount(macroNameVolumeCount, 1, validateVolumeCount), lePathPrefix(pathPrefixBox), sbVolSize(volSizeBox), @@ -125,6 +137,9 @@ VolumeSettings::VolumeSettings(QLineEdit *pathPrefixBox, labelVolSizeBytes(volSizeLabel), cmbSectorSize(sectorSizeBox), cmbAtomicWrite(atomicWriteBox), + cbEnableRetries(enableRetriesCheck), + sbNumRetries(numRetriesBox), + widgetNumRetries(numRetriesWidget), btnAdd(addButton), btnRemSelected(removeButton), listVolumes(volumesList), @@ -134,6 +149,7 @@ VolumeSettings::VolumeSettings(QLineEdit *pathPrefixBox, wbtnVolSize(volSizeWarn), wbtnInodeCount(inodeCountWarn), wbtnAtomicWrite(atomicWriteWarn), + wbtnIoRetries(ioRetriesWarn), volTick(0) { Q_ASSERT(allSettings.rbtnsUsePosix != NULL); @@ -143,21 +159,25 @@ VolumeSettings::VolumeSettings(QLineEdit *pathPrefixBox, SetActiveVolume(volumes.count() - 1); connect(lePathPrefix, SIGNAL(textChanged(QString)), - this, SLOT(lePathPrefix_textChanged(QString))); + this, SLOT(lePathPrefix_textChanged(QString))); connect(sbVolSize, SIGNAL(valueChanged(QString)), - this, SLOT(sbVolSize_valueChanged(QString))); + this, SLOT(sbVolSize_valueChanged(QString))); connect(sbInodeCount, SIGNAL(valueChanged(QString)), - this, SLOT(sbInodeCount_valueChanged(QString))); + this, SLOT(sbInodeCount_valueChanged(QString))); connect(cmbSectorSize, SIGNAL(currentIndexChanged(int)), - this, SLOT(cmbSectorSize_currentIndexChanged(int))); + this, SLOT(cmbSectorSize_currentIndexChanged(int))); connect(cmbAtomicWrite, SIGNAL(currentIndexChanged(int)), - this, SLOT(cmbAtomicWrite_currentIndexChanged(int))); + this, SLOT(cmbAtomicWrite_currentIndexChanged(int))); + connect(cbEnableRetries, SIGNAL(stateChanged(int)), + this, SLOT(cbEnableRetries_stateChanged(int))); + connect(sbNumRetries, SIGNAL(valueChanged(QString)), + this, SLOT(sbNumRetries_valueChanged(QString))); connect(listVolumes, SIGNAL(currentRowChanged(int)), - this, SLOT(listVolumes_currentRowChanged(int))); + this, SLOT(listVolumes_currentRowChanged(int))); connect(btnAdd, SIGNAL(clicked()), - this, SLOT(btnAdd_clicked())); + this, SLOT(btnAdd_clicked())); connect(btnRemSelected, SIGNAL(clicked()), - this, SLOT(btnRemSelected_clicked())); + this, SLOT(btnRemSelected_clicked())); updateVolSizeBytes(); } @@ -246,6 +266,14 @@ void VolumeSettings::SetActiveVolume(int index) cmbAtomicWrite->setCurrentText(volumes[index]->GetStAtomicWrite()->GetValue()); + unsigned long ioRetriesValue = volumes[index]->GetStBlockIoRetries()->GetValue(); + widgetNumRetries->setEnabled(ioRetriesValue != 0); + cbEnableRetries->setChecked(ioRetriesValue != 0); + if(ioRetriesValue != 0) + { + sbNumRetries->setValue(ioRetriesValue); + } + listVolumes->setCurrentRow(index); } @@ -254,7 +282,7 @@ void VolumeSettings::AddVolume() QString name = QString("VOL") + QString::number(volTick) + QString(":"); volumes.append(new Volume(name, wbtnPathPrefix, wbtnSectorSize, wbtnVolSize, - wbtnInodeCount, wbtnAtomicWrite)); + wbtnInodeCount, wbtnAtomicWrite, wbtnIoRetries)); volTick++; if(!usePosix) @@ -312,6 +340,7 @@ void VolumeSettings::GetErrors(QStringList &errors, QStringList &warnings) AllSettings::CheckError(volumes[i]->GetStInodeCount(), errors, warnings); AllSettings::CheckError(volumes[i]->GetStSectorSize(), errors, warnings); AllSettings::CheckError(volumes[i]->GetStAtomicWrite(), errors, warnings); + AllSettings::CheckError(volumes[i]->GetStBlockIoRetries(), errors, warnings); } if(activeIndex != rememberIndex) { @@ -324,6 +353,7 @@ void VolumeSettings::GetErrors(QStringList &errors, QStringList &warnings) volumes[activeIndex]->GetStInodeCount()->Notify(); volumes[activeIndex]->GetStSectorSize()->Notify(); volumes[activeIndex]->GetStAtomicWrite()->Notify(); + volumes[activeIndex]->GetStBlockIoRetries()->Notify(); } } @@ -376,6 +406,9 @@ const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT] =\n\ ? QString("true") : QString("false")) + QString(", ") + QString::number(volumes[i]->GetStInodeCount()->GetValue()) + + QString("U") + + QString(", ") + + QString::number(volumes[i]->GetStBlockIoRetries()->GetValue()) + QString("U"); Q_ASSERT(allSettings.rbtnsUsePosix != NULL); @@ -425,16 +458,16 @@ void VolumeSettings::ParseCodefile(const QString &text, exp = QRegularExpression("\\{\\s*([\\s\\S]*?)\\s*\\}\\s*,?"); - // Skip comment: (/\\*[\\s\\S]*?\\*/)? - // Capture value: (\\w*) - // Skip final whitespace: \\s* - QRegularExpression valueExp = QRegularExpression("(/\\*[\\s\\S]*?\\*/)?\\s*(\\w*),?\\s*"); + // Skip comment (capture index 1): (/\\*[\\s\\S]*?\\*/)? + // Capture value (capture index 2): (\\w+) + // Ensure we caught the whole argument, skip final whitespace: \\s*(,\\s*|$) + QRegularExpression valueExp = QRegularExpression("(/\\*[\\s\\S]*?\\*/)?\\s*(\\w+)\\s*(,\\s*|$)"); - // Same regex as valueExp, except value is enclosed in quotation marks + // Same regex as valueExp, except value is enclosed in + // quotation marks and may be empty. QRegularExpression pathPrefixEpx = QRegularExpression("(/\\*[\\s\\S]*?\\*/)?\"(.*?)\",?\\s*"); - // The position in strVolumes to start looking for - // the next volume + // The position in strVolumes to start looking for the next volume int currPos = 0; int currVolIndex = 0; QList newVolumes; @@ -458,12 +491,19 @@ void VolumeSettings::ParseCodefile(const QString &text, // List of unparsed values of the settings of the current volume QStringList strValues; - for(int i = 0; i < 4; i++) + for(int i = 0; i < 5; i++) { rem = valueExp.match(currStr, currVolPos); if(!rem.hasMatch() || rem.lastCapturedIndex() < 2) { - failure = true; + // Don't report failure if the I/O Retries setting + // (index 4) isn't found. This allows the config tool + // to load files generated by older versions (1.0) of + // the tool. + if(i < 4) + { + failure = true; + } break; } strValues += rem.captured(2); @@ -496,7 +536,8 @@ void VolumeSettings::ParseCodefile(const QString &text, wbtnSectorSize, wbtnVolSize, wbtnInodeCount, - wbtnAtomicWrite); + wbtnAtomicWrite, + wbtnIoRetries); parseAndSet(newVol->GetStSectorSize(), strValues[0], notParsed, pathPrefix + QString(" sector size")); @@ -520,6 +561,14 @@ void VolumeSettings::ParseCodefile(const QString &text, parseAndSet(newVol->GetStInodeCount(), strValues[3], notParsed, pathPrefix + QString(" inode count")); + // Don't complain if I/O retries setting isn't found (see + // comments above). + if(strValues.count() > 4) + { + parseAndSet(newVol->GetStBlockIoRetries(), strValues[4], notParsed, + pathPrefix + QString(" block I/O retries")); + } + newVolumes.append(newVol); currVolIndex++; } @@ -812,6 +861,32 @@ void VolumeSettings::cmbAtomicWrite_currentIndexChanged(int index) } } +void VolumeSettings::cbEnableRetries_stateChanged(int state) +{ + widgetNumRetries->setEnabled(state == Qt::Checked); + + if(state == Qt::Checked) + { + volumes[activeIndex]->GetStBlockIoRetries() + ->ProcessInput(sbNumRetries->text()); + } + else + { + // Unchecked -> disable retries -> max 0 retries. + volumes[activeIndex]->GetStBlockIoRetries() + ->ProcessInput("0"); + } +} + +void VolumeSettings::sbNumRetries_valueChanged(const QString & text) +{ + if(cbEnableRetries->isChecked()) + { + volumes[activeIndex]->GetStBlockIoRetries() + ->ProcessInput(text); + } +} + void VolumeSettings::listVolumes_currentRowChanged(int row) { if(row < 0 || row == activeIndex) diff --git a/os/win32/tools/config/volumesettings.h b/os/win32/tools/config/volumesettings.h index f4c75ee..26be062 100644 --- a/os/win32/tools/config/volumesettings.h +++ b/os/win32/tools/config/volumesettings.h @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -65,12 +66,14 @@ class VolumeSettings : QObject WarningBtn *wbtnSectorSize, WarningBtn *wbtnVolSize, WarningBtn *wbtnInodeCount, - WarningBtn *wbtnAtomicWrite); + WarningBtn *wbtnAtomicWrite, + WarningBtn *wbtnBlockIoRetries); StrSetting *GetStName(); IntSetting *GetStSectorSize(); IntSetting *GetStSectorCount(); IntSetting *GetStInodeCount(); StrSetting *GetStAtomicWrite(); + IntSetting *GetStBlockIoRetries(); bool NeedsExternalImap(); private: @@ -79,6 +82,7 @@ class VolumeSettings : QObject IntSetting stInodeCount; IntSetting stSectorSize; StrSetting stAtomicWrite; + IntSetting stBlockIoRetries; }; /// @@ -92,6 +96,9 @@ class VolumeSettings : QObject QLabel *volSizeLabel, QSpinBox *inodeCountBox, QComboBox *atomicWriteBox, + QCheckBox *enableRetriesCheck, + QSpinBox *numRetriesBox, + QWidget *numRetriesWidget, QPushButton *addButton, QPushButton *removeButton, QListWidget *volumesList, @@ -100,7 +107,8 @@ class VolumeSettings : QObject WarningBtn *sectorSizeWarn, WarningBtn *volSizeWarn, WarningBtn *inodeCountWarn, - WarningBtn *atomicWriteWarn); + WarningBtn *atomicWriteWarn, + WarningBtn *ioRetriesWarn); ~VolumeSettings(); /// @@ -179,8 +187,15 @@ class VolumeSettings : QObject /// \brief Parse C code, loading volume settings. /// /// This function is only required to correctly load settings from - /// text that has been created by ::FormatCodefileOutput. It will - /// attempt to load settings from any + /// text that has been created by ::FormatCodefileOutput. If the + /// text has been edited, it may or may not be legible to this + /// method even if it is valid C code. + /// + /// If the given text was modified outside of the configuration + /// tool to contain invalid values for any settings, the program + /// behavior is undefined. (For example, some fields of the + /// configuration tool may display correct values but have a + /// warning or error flag until the value is modified.) /// /// \param text A string of C code from a redconf.c file. /// \param notFound A list to which to append the name of any settings @@ -229,6 +244,9 @@ class VolumeSettings : QObject QLabel *labelVolSizeBytes; QComboBox *cmbSectorSize; QComboBox *cmbAtomicWrite; + QCheckBox *cbEnableRetries; + QSpinBox *sbNumRetries; + QWidget *widgetNumRetries; // Enabled only when cbEnableRetries is checked. QPushButton *btnAdd; QPushButton *btnRemSelected; QListWidget *listVolumes; @@ -239,6 +257,7 @@ class VolumeSettings : QObject WarningBtn *wbtnInodeCount; WarningBtn *wbtnSectorSize; WarningBtn *wbtnAtomicWrite; + WarningBtn *wbtnIoRetries; private slots: void lePathPrefix_textChanged(const QString &text); @@ -246,6 +265,8 @@ private slots: void sbVolSize_valueChanged(const QString &value); void sbInodeCount_valueChanged(const QString &value); void cmbAtomicWrite_currentIndexChanged(int index); + void cbEnableRetries_stateChanged(int state); + void sbNumRetries_valueChanged(const QString & text); void listVolumes_currentRowChanged(int row); void btnAdd_clicked(); void btnRemSelected_clicked(); diff --git a/projects/freertos/atmel/sam4e-ek/src/config/redconf.c b/projects/freertos/atmel/sam4e-ek/src/config/redconf.c index 8382436..7d8477d 100644 --- a/projects/freertos/atmel/sam4e-ek/src/config/redconf.c +++ b/projects/freertos/atmel/sam4e-ek/src/config/redconf.c @@ -11,6 +11,5 @@ const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT] = { - { 512U, 3862528U, false, 1024U, ""} + { 512U, 3862528U, false, 1024U, 0U, "" } }; - diff --git a/projects/freertos/atmel/sam4e-ek/src/config/redconf.h b/projects/freertos/atmel/sam4e-ek/src/config/redconf.h index 6ac2efa..a5b4398 100644 --- a/projects/freertos/atmel/sam4e-ek/src/config/redconf.h +++ b/projects/freertos/atmel/sam4e-ek/src/config/redconf.h @@ -102,4 +102,3 @@ #define REDCONF_CHECKER 0 #endif - diff --git a/projects/freertos/atmel/sam4s-xplained-pro/src/config/redconf.c b/projects/freertos/atmel/sam4s-xplained-pro/src/config/redconf.c index 3387c8f..c0d7db2 100644 --- a/projects/freertos/atmel/sam4s-xplained-pro/src/config/redconf.c +++ b/projects/freertos/atmel/sam4s-xplained-pro/src/config/redconf.c @@ -11,5 +11,5 @@ const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT] = { - { 512U, 979965U, false, 1024U } + { 512U, 979965U, false, 1024U, 0U } }; diff --git a/projects/freertos/st/stm324xg-eval/.cproject b/projects/freertos/st/stm324xg-eval/.cproject new file mode 100644 index 0000000..867f5aa --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/.cproject @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/freertos/st/stm324xg-eval/.project b/projects/freertos/st/stm324xg-eval/.project new file mode 100644 index 0000000..33e0123 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/.project @@ -0,0 +1,362 @@ + + + STM324xG-EVAL_FreeRTOS_Redfs + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/STM324xG-EVAL_FreeRTOS_Redfs/Debug} + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + Drivers + 2 + virtual:/virtual + + + FreeRTOS + 2 + virtual:/virtual + + + RelianceEdge + 2 + virtual:/virtual + + + Drivers/BSP + 2 + virtual:/virtual + + + Drivers/CMSIS + 2 + virtual:/virtual + + + Drivers/STM32F4xx_HAL_Driver + 2 + virtual:/virtual + + + FreeRTOS/croutine.c + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/croutine.c + + + FreeRTOS/include + 2 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/include + + + FreeRTOS/list.c + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/list.c + + + FreeRTOS/portable + 2 + virtual:/virtual + + + FreeRTOS/queue.c + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/queue.c + + + FreeRTOS/tasks.c + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/tasks.c + + + FreeRTOS/timers.c + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/timers.c + + + RelianceEdge/bitmap.c + 1 + REDFS_SRC_PATH/util/bitmap.c + + + RelianceEdge/blockio.c + 1 + REDFS_SRC_PATH/core/driver/blockio.c + + + RelianceEdge/buffer.c + 1 + REDFS_SRC_PATH/core/driver/buffer.c + + + RelianceEdge/core.c + 1 + REDFS_SRC_PATH/core/driver/core.c + + + RelianceEdge/crc.c + 1 + REDFS_SRC_PATH/util/crc.c + + + RelianceEdge/dir.c + 1 + REDFS_SRC_PATH/core/driver/dir.c + + + RelianceEdge/endian.c + 1 + REDFS_SRC_PATH/util/endian.c + + + RelianceEdge/format.c + 1 + REDFS_SRC_PATH/core/driver/format.c + + + RelianceEdge/imap.c + 1 + REDFS_SRC_PATH/core/driver/imap.c + + + RelianceEdge/imapextern.c + 1 + REDFS_SRC_PATH/core/driver/imapextern.c + + + RelianceEdge/imapinline.c + 1 + REDFS_SRC_PATH/core/driver/imapinline.c + + + RelianceEdge/inode.c + 1 + REDFS_SRC_PATH/core/driver/inode.c + + + RelianceEdge/inodedata.c + 1 + REDFS_SRC_PATH/core/driver/inodedata.c + + + RelianceEdge/memory.c + 1 + REDFS_SRC_PATH/util/memory.c + + + RelianceEdge/namelen.c + 1 + REDFS_SRC_PATH/util/namelen.c + + + RelianceEdge/osassert.c + 1 + REDFS_SRC_PATH/os/freertos/services/osassert.c + + + RelianceEdge/osbdev.c + 1 + REDFS_SRC_PATH/os/freertos/services/osbdev.c + + + RelianceEdge/osclock.c + 1 + REDFS_SRC_PATH/os/freertos/services/osclock.c + + + RelianceEdge/osmutex.c + 1 + REDFS_SRC_PATH/os/freertos/services/osmutex.c + + + RelianceEdge/ostask.c + 1 + REDFS_SRC_PATH/os/freertos/services/ostask.c + + + RelianceEdge/ostimestamp.c + 1 + REDFS_SRC_PATH/os/freertos/services/ostimestamp.c + + + RelianceEdge/path.c + 1 + REDFS_SRC_PATH/posix/path.c + + + RelianceEdge/posix.c + 1 + REDFS_SRC_PATH/posix/posix.c + + + RelianceEdge/sign.c + 1 + REDFS_SRC_PATH/util/sign.c + + + RelianceEdge/string.c + 1 + REDFS_SRC_PATH/util/string.c + + + RelianceEdge/volume.c + 1 + REDFS_SRC_PATH/core/driver/volume.c + + + src/lcd_log.c + 1 + STM32CubeFWPath/Utilities/Log/lcd_log.c + + + src/lcd_log.h + 1 + STM32CubeFWPath/Utilities/Log/lcd_log.h + + + src/startup_stm32f407xx.s + 1 + STM32CubeFWPath/Projects/STM324xG_EVAL/Templates/TrueSTUDIO/startup_stm32f407xx.s + + + src/system_stm32f4xx.c + 1 + STM32CubeFWPath/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c + + + Drivers/BSP/Components + 2 + virtual:/virtual + + + Drivers/BSP/STM324xG_EVAL + 2 + STM32CubeFWPath/Drivers/BSP/STM324xG_EVAL + + + Drivers/CMSIS/cmsis_os.c + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c + + + Drivers/CMSIS/stm32f407xx.h + 1 + STM32CubeFWPath/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h + + + Drivers/CMSIS/stm32f4xx.h + 1 + STM32CubeFWPath/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h + + + Drivers/STM32F4xx_HAL_Driver/Inc + 2 + STM32CubeFWPath/Drivers/STM32F4xx_HAL_Driver/Inc + + + Drivers/STM32F4xx_HAL_Driver/Src + 2 + STM32CubeFWPath/Drivers/STM32F4xx_HAL_Driver/Src + + + FreeRTOS/portable/heap_4.c + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_4.c + + + FreeRTOS/portable/port.c + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c + + + FreeRTOS/portable/portmacro.h + 1 + STM32CubeFWPath/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h + + + Drivers/BSP/Components/Common + 2 + STM32CubeFWPath/Drivers/BSP/Components/Common + + + Drivers/BSP/Components/ili9325 + 2 + STM32CubeFWPath/Drivers/BSP/Components/ili9325 + + + Drivers/BSP/Components/stmpe811 + 2 + STM32CubeFWPath/Drivers/BSP/Components/stmpe811 + + + + + REDFS_SRC_PATH + $%7BPARENT-4-PROJECT_LOC%7D + + + STM32CubeFWPath + file:/C:/STM32Cube_FW_F4_V1.11.0 + + + diff --git a/projects/freertos/st/stm324xg-eval/.settings/com.atollic.truestudio.debug.hardware_device.prefs b/projects/freertos/st/stm324xg-eval/.settings/com.atollic.truestudio.debug.hardware_device.prefs new file mode 100644 index 0000000..c370f0b --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/.settings/com.atollic.truestudio.debug.hardware_device.prefs @@ -0,0 +1,11 @@ +BOARD=STM324xG-EVAL +CODE_LOCATION=FLASH +ENDIAN=Little-endian +MCU=STM32F407IG +MCU_VENDOR=STMicroelectronics +MODEL=Pro +PROBE=ST-LINK +PROJECT_FORMAT_VERSION=2 +TARGET=ARM\u00AE +VERSION=3.2.0 +eclipse.preferences.version=1 diff --git a/projects/freertos/st/stm324xg-eval/README.txt b/projects/freertos/st/stm324xg-eval/README.txt new file mode 100644 index 0000000..8f4bf1a --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/README.txt @@ -0,0 +1,69 @@ +README for the Reliance Edge STM324xG-EVAL project + +Overview +======== + +This is an Atollic TrueSTUDIO project for the ST Microelectonics STM324xG-EVAL +board. It is intended to demonstrate using Reliance Edge with FreeRTOS on an +STM324xG-EVAL platform. + +The program does nothing more than formatting the SD card and mounting it as a +Reliance Edge volume. A separate task monitors the joystick control and scrolls +outputted text up or down in response. This feature is not currently useable +because the example program does not print more text than fits on the screen, +but it is included for the developer's convenience should you wish to run an +actual test instead of the example code. + +This project includes a customized osoutput.c file instead of +os/freertos/services/osoutput.c. This is because putchar() did not work as +expected using the Atollic GCC toolchain; the customized file calls +__io_putchar() directly instead. + + +Project Setup +============= + +STM32Cube +--------- + +This project does not ship with the drivers, board support package, or +linker scripts for the target. These source files are all part of the +STM32CubeF4 package. Follow these steps to allow the project to find the +resources needed: + + - Download STM32CubeF4: http://www.st.com/web/en/catalog/tools/PF259243 + - Unzip the STM32CubeF4 package to a desirable location; e.g. + C:/ST/STM32Cube_FW_F4. + - In this project's properties page (in Atollic TrueStudio), select + Resource -> Linked Resources -> Path Variables tab. Change the + STM32CubeFWPath to point to the STM32CubeF4 package; e.g. C:/ST/STM32Cube_FW_F4. + - In the properties page, select C/C++ Build -> Build Variables, and again set + STM32CubeFWPath to the correct path. + +The STM32CubeF4 package also contains a copy of the FreeRTOS source code, which +is used by this project. + +This project has been tested to work with versions 1.9.0 and 1.11.0 of +STM32CubeF4. + +Reliance Edge Block Device +-------------------------- + +Reliance Edge comes with several reference block device interfaces for use on +FreeRTOS. Before building this project, make sure the correct implementation +is selected. Open the file Reliance Edge/osbdev.c (os/freertos/services/osbdev.c) +and ensure the macro BDEV_EXAMPLE_IMPLEMENTATION is defined to BDEV_STM32_SDIO. + +Tested Versions +--------------- + +This project has been tested with Atollic TrueStudio versions 5.3 and 5.4. +Both the Pro and the Lite versions may be used. + +Resources +--------- + +Atollic TrueStudio is available at http://timor.atollic.com/truestudio/ + +The Lite version is free, even though it is a fully functional IDE. The +Pro version may be used for a monthly fee. diff --git a/projects/freertos/st/stm324xg-eval/host/Makefile b/projects/freertos/st/stm324xg-eval/host/Makefile new file mode 100644 index 0000000..2a68b14 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/host/Makefile @@ -0,0 +1,10 @@ +# +# Makefile for a Reliance Edge Win32 host tools project +# +P_BASEDIR ?= ../../../../.. +P_PROJDIR ?= ./ +P_CONFDIR ?= $(P_PROJDIR)/../src +B_DEBUG ?= 1 + +include $(P_BASEDIR)/os/win32/build/host.mk + diff --git a/projects/freertos/st/stm324xg-eval/host/redconf.c b/projects/freertos/st/stm324xg-eval/host/redconf.c new file mode 100644 index 0000000..725ae53 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/host/redconf.c @@ -0,0 +1,7 @@ +/** @file +*/ + +/* The host tools use the same volume configuration as the target. +*/ +#include "../src/redconf.c" + diff --git a/projects/freertos/st/stm324xg-eval/host/redconf.h b/projects/freertos/st/stm324xg-eval/host/redconf.h new file mode 100644 index 0000000..9ad1428 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/host/redconf.h @@ -0,0 +1,106 @@ +/** @file +*/ + +/* Inherit most settings from the target configuration. +*/ +#include "../src/redconf.h" + + +#ifndef HOST_REDCONF_H +#define HOST_REDCONF_H + + +/* Assuming the host machine is little endian. If the host machine is actually + big endian, this can be worked around by changing the below "== 1" to "== 0" + and setting REDCONF_ENDIAN_BIG to 1 below. +*/ +#if REDCONF_ENDIAN_BIG == 1 +#define REDCONF_ENDIAN_SWAP +#endif + +#undef REDCONF_ENDIAN_BIG +#define REDCONF_ENDIAN_BIG 0 + +/* Ignore the target system memory alignment. For Windows, 4 bytes works well. +*/ +#undef REDCONF_ALIGNMENT_SIZE +#define REDCONF_ALIGNMENT_SIZE 4U + +/* Host tools always have output. +*/ +#undef REDCONF_OUTPUT +#define REDCONF_OUTPUT 1 + +/* Read-only must be disabled for the image builder. +*/ +#undef REDCONF_READ_ONLY +#define REDCONF_READ_ONLY 0 + +/* Enable the checker host tool. +*/ +#undef REDCONF_CHECKER +#define REDCONF_CHECKER 1 + +/* Enable the formatter code in POSIX-like API configurations for the image + builder and formatter host tools. +*/ +#undef REDCONF_API_POSIX_FORMAT +#define REDCONF_API_POSIX_FORMAT 1 + +/* Enable the image builder host tool. +*/ +#undef REDCONF_IMAGE_BUILDER +#define REDCONF_IMAGE_BUILDER 1 + +/* The image builder needs red_mkdir(). +*/ +#undef REDCONF_API_POSIX_MKDIR +#define REDCONF_API_POSIX_MKDIR 1 + +/* The image copier utility needs red_readdir(). +*/ +#undef REDCONF_API_POSIX_READDIR +#define REDCONF_API_POSIX_READDIR 1 + +/* The image copier utility needs a handle for every level of directory depth. + While Reliance Edge has no maximum directory depth or path depth, Windows + limits paths to 260 bytes, and each level of depth eats up at least two + characters, 130 handles will be sufficient for all images that can be + copied. +*/ +#undef REDCONF_HANDLE_COUNT +#define REDCONF_HANDLE_COUNT 130U + +/* Use the fastest CRC algorithm for the tools. Slice-by-8 will work well on + a host machine and the extra code space is a nonissue. +*/ +#undef REDCONF_CRC_ALGORITHM +#define REDCONF_CRC_ALGORITHM CRC_SLICEBY8 + +/* The target redconf.h may have configured the memory and string functions to + use custom implementations that are only available on the target system. So + for the host, we just use the C library versions. +*/ +#include + +#undef RedMemCpyUnchecked +#define RedMemCpyUnchecked memcpy +#undef RedMemMoveUnchecked +#define RedMemMoveUnchecked memmove +#undef RedMemSetUnchecked +#define RedMemSetUnchecked memset +#undef RedMemCmpUnchecked +#define RedMemCmpUnchecked memcmp + +#undef RedStrLenUnchecked +#define RedStrLenUnchecked strlen +#undef RedStrCmpUnchecked +#define RedStrCmpUnchecked strcmp +#undef RedStrNCmpUnchecked +#define RedStrNCmpUnchecked strncmp +#undef RedStrNCpyUnchecked +#define RedStrNCpyUnchecked strncpy + + +#endif + diff --git a/projects/freertos/st/stm324xg-eval/host/redtypes.h b/projects/freertos/st/stm324xg-eval/host/redtypes.h new file mode 100644 index 0000000..9ec53cc --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/host/redtypes.h @@ -0,0 +1,110 @@ +/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- + + Copyright (c) 2014-2015 Datalight, Inc. + All Rights Reserved Worldwide. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; use version 2 of the License. + + This program is distributed in the hope that it will be useful, + but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +/* Businesses and individuals that for commercial or other reasons cannot + comply with the terms of the GPLv2 license may obtain a commercial license + before incorporating Reliance Edge into proprietary software for + distribution in any form. Visit http://www.datalight.com/reliance-edge for + more information. +*/ +/** @file + @brief Defines basic types used by Reliance Edge. + + The following types *must* be defined by this header, either directly (using + typedef) or indirectly (by including other headers, such as the C99 headers + stdint.h and stdbool.h): + + - bool: Boolean type, capable of storing true (1) or false (0) + - uint8_t: Unsigned 8-bit integer + - int8_t: Signed 8-bit integer + - uint16_t: Unsigned 16-bit integer + - int16_t: Signed 16-bit integer + - uint32_t: Unsigned 32-bit integer + - int32_t: Signed 32-bit integer + - uint64_t: Unsigned 64-bit integer + - int64_t: Signed 64-bit integer + - uintptr_t: Unsigned integer capable of storing a pointer, preferably the + same size as pointers themselves. + + These types deliberately use the same names as the standard C99 types, so + that if the C99 headers stdint.h and stdbool.h are available, they may be + included here. + + If the user application defines similar types, those may be reused. For + example, suppose there is an application header apptypes.h which defines + types with a similar purpose but different names. That header could be + reused to define the types Reliance Edge needs: + + ~~~{.c} + #include + + typedef BOOL bool; + typedef BYTE uint8_t; + typedef INT8 int8_t; + // And so on... + ~~~ + + If there are neither C99 headers nor suitable types in application headers, + this header should be populated with typedefs that define the required types + in terms of the standard C types. This requires knowledge of the size of + the C types on the target hardware (e.g., how big is an "int" or a pointer). + Below is an example which assumes the target has 8-bit chars, 16-bit shorts, + 32-bit ints, 32-bit pointers, and 64-bit long longs: + + ~~~{.c} + typedef int bool; + typedef unsigned char uint8_t; + typedef signed char int8_t; + typedef unsigned short uint16_t; + typedef short int16_t; + typedef unsigned int uint32_t; + typedef int int32_t; + typedef unsigned long long uint64_t; + typedef long long int64_t; + typedef uint32_t uintptr_t; + ~~~ +*/ +#ifndef REDTYPES_H +#define REDTYPES_H + + +typedef int bool; /**< @brief Boolean type; either true or false. */ + +typedef unsigned __int8 uint8_t; /**< @brief Unsigned 8-bit integer. */ +typedef __int8 int8_t; /**< @brief Signed 8-bit integer. */ + +typedef unsigned __int16 uint16_t; /**< @brief Unsigned 16-bit integer. */ +typedef __int16 int16_t; /**< @brief Signed 16-bit integer. */ + +typedef unsigned __int32 uint32_t; /**< @brief Unsigned 32-bit integer. */ +typedef __int32 int32_t; /**< @brief Signed 32-bit integer. */ + +typedef unsigned __int64 uint64_t; /**< @brief Unsigned 64-bit integer. */ +typedef __int64 int64_t; /**< @brief Signed 64-bit integer. */ + +/** @brief Unsigned integer capable of storing a pointer. +*/ +#ifdef _WIN64 +typedef uint64_t uintptr_t; +#else +typedef uint32_t uintptr_t; +#endif + + +#endif + diff --git a/projects/freertos/st/stm324xg-eval/src/FreeRTOSConfig.h b/projects/freertos/st/stm324xg-eval/src/FreeRTOSConfig.h new file mode 100644 index 0000000..9bcae33 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/FreeRTOSConfig.h @@ -0,0 +1,145 @@ +/* + FreeRTOS V7.1.1 - Copyright (C) 2012 Real Time Engineers Ltd. + + + *************************************************************************** + * * + * FreeRTOS tutorial books are available in pdf and paperback. * + * Complete, revised, and edited pdf reference manuals are also * + * available. * + * * + * Purchasing FreeRTOS documentation will not only help you, by * + * ensuring you get running as quickly as possible and with an * + * in-depth knowledge of how to use FreeRTOS, it will also help * + * the FreeRTOS project to continue with its mission of providing * + * professional grade, cross platform, de facto standard solutions * + * for microcontrollers - completely free of charge! * + * * + * >>> See http://www.FreeRTOS.org/Documentation for details. <<< * + * * + * Thank you for using FreeRTOS, and thank you for your support! * + * * + *************************************************************************** + + + This file is part of the FreeRTOS distribution. + + FreeRTOS is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License (version 2) as published by the + Free Software Foundation AND MODIFIED BY the FreeRTOS exception. + >>>NOTE<<< The modification to the GPL is included to allow you to + distribute a combined work that includes FreeRTOS without being obliged to + provide the source code for proprietary components outside of the FreeRTOS + kernel. FreeRTOS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained + by writing to Richard Barry, contact details for whom are available on the + FreeRTOS WEB site. + + 1 tab == 4 spaces! + + *************************************************************************** + * * + * Having a problem? Start by reading the FAQ "My application does * + * not run, what could be wrong? * + * * + * http://www.FreeRTOS.org/FAQHelp.html * + * * + *************************************************************************** + + + http://www.FreeRTOS.org - Documentation, training, latest information, + license and contact details. + + http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, + including FreeRTOS+Trace - an indispensable productivity tool. + + Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell + the code with commercial support, indemnification, and middleware, under + the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also + provide a safety engineered and independently SIL3 certified version under + the SafeRTOS brand: http://www.SafeRTOS.com. +*/ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html. + *----------------------------------------------------------*/ + +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 +#define configCPU_CLOCK_HZ ( 168000000UL ) +#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) +#define configMAX_PRIORITIES ( 5 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 80 * 1024 ) ) +#define configMAX_TASK_NAME_LEN ( 10 ) +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 16 +#define configGENERATE_RUN_TIME_STATS 0 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configUSE_RECURSIVE_MUTEXES 0 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_COUNTING_SEMAPHORES 0 + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) + +/* Software timer definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY ( 3 ) +#define configTIMER_QUEUE_LENGTH 5 +#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE ) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 + +/* Use the system definition, if there is one */ +#ifdef __NVIC_PRIO_BITS + #define configPRIO_BITS __NVIC_PRIO_BITS +#else + #define configPRIO_BITS 4 /* 15 priority levels */ +#endif + +#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15 +#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 + +/* The lowest priority. */ +#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) +/* Priority 5, or 95 as only the top four bits are implemented. */ +#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) + +#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } + +#define vPortSVCHandler SVC_Handler +#define xPortPendSVHandler PendSV_Handler + +#endif /* FREERTOS_CONFIG_H */ + diff --git a/projects/freertos/st/stm324xg-eval/src/hooks.c b/projects/freertos/st/stm324xg-eval/src/hooks.c new file mode 100644 index 0000000..1d9f83b --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/hooks.c @@ -0,0 +1,107 @@ +/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- + + Copyright (c) 2014-2015 Datalight, Inc. + All Rights Reserved Worldwide. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; use version 2 of the License. + + This program is distributed in the hope that it will be useful, + but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +/* Businesses and individuals that for commercial or other reasons cannot + comply with the terms of the GPLv2 license may obtain a commercial license + before incorporating Reliance Edge into proprietary software for + distribution in any form. Visit http://www.datalight.com/reliance-edge for + more information. +*/ +/** @file + @brief FreeRTOS assert and hook implementations. +*/ + +#include + +#include +#include + +#include + + +extern void vAssertCalled(uint32_t ulLine, const char *pcFile); + + +/** @brief Handler for asserts firing from the FreeRTOS code. +*/ +void vAssertCalled( + uint32_t ulLine, + const char *pcFile) +{ + /* The following two variables are just to ensure the parameters are not + optimized away and therefore unavailable when viewed in the debugger. + */ + volatile uint32_t ulLineNumber = ulLine, ulSetNonZeroInDebuggerToReturn = 0; + volatile const char * const pcFileName = pcFile; + + /* Invoke Reliance Edge assertion handler if available. + */ + RedOsAssertFail(pcFile, ulLine); + + taskENTER_CRITICAL(); + while( ulSetNonZeroInDebuggerToReturn == 0 ) + { + /* If you want to get out of this function in the debugger to see the + assert() location then set ulSetNonZeroInDebuggerToReturn to a + non-zero value. + */ + } + taskEXIT_CRITICAL(); + + (void)pcFileName; + (void)ulLineNumber; +} + + +#if configCHECK_FOR_STACK_OVERFLOW > 0 +/* Prototype to quiet a warning. +*/ +extern void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName); + + +/** @brief Handler for stack overflows. +*/ +void vApplicationStackOverflowHook( + TaskHandle_t pxTask, + char *pcTaskName) +{ + (void)pcTaskName; + (void)pxTask; + + /* Run time stack overflow checking is performed if + configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook + function is called if a stack overflow is detected. + */ + vAssertCalled(__LINE__, __FILE__); +} +#endif + + +#if configUSE_MALLOC_FAILED_HOOK != 0 +extern void vApplicationMallocFailedHook(void); + + +void vApplicationMallocFailedHook(void) +{ + /* Produce output even if asserts are disabled. + */ + fprintf(stderr, "Memory allocation failed!\n\r"); + + REDERROR(); +} +#endif diff --git a/projects/freertos/st/stm324xg-eval/src/lcd_log_conf.h b/projects/freertos/st/stm324xg-eval/src/lcd_log_conf.h new file mode 100644 index 0000000..753f409 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/lcd_log_conf.h @@ -0,0 +1,86 @@ +/** + ****************************************************************************** + * @file lcd_log_conf.h + * @author MCD Application Team + * @version V1.0.0 + * @date 18-February-2014 + * @brief lcd_log configuration file. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2014 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ + +#ifndef __LCD_LOG_CONF_H__ +#define __LCD_LOG_CONF_H__ + + +/* Includes ------------------------------------------------------------------*/ +#include "stm324xg_eval_lcd.h" +#include + + +/* Comment the line below to disable the scroll back and forward features */ +#define LCD_SCROLL_ENABLED 1 + +/* Define the Fonts */ +#define LCD_LOG_HEADER_FONT Font16 +#define LCD_LOG_FOOTER_FONT Font12 +#define LCD_LOG_TEXT_FONT Font12 + +/* Define the LCD LOG Color */ +#define LCD_LOG_BACKGROUND_COLOR LCD_COLOR_BLACK +#define LCD_LOG_TEXT_COLOR LCD_COLOR_WHITE + +#define LCD_LOG_SOLID_BACKGROUND_COLOR LCD_COLOR_DARKCYAN +#define LCD_LOG_SOLID_TEXT_COLOR LCD_COLOR_WHITE + +/* Define the cache depth */ +#define CACHE_SIZE 20 +#define YWINDOW_SIZE 17 + +#if (YWINDOW_SIZE > 17) + #error "Wrong YWINDOW SIZE" +#endif + +/* Redirect the printf to the LCD */ +#ifdef __GNUC__ +/* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf + set to 'Yes') calls __io_putchar() */ +#define LCD_LOG_PUTCHAR int __io_putchar(int ch) +#else +#define LCD_LOG_PUTCHAR int fputc(int ch, FILE *f) +#endif /* __GNUC__ */ + +#endif //__LCD_LOG_CONF_H__ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + + diff --git a/projects/freertos/st/stm324xg-eval/src/main.c b/projects/freertos/st/stm324xg-eval/src/main.c new file mode 100644 index 0000000..47b88f6 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/main.c @@ -0,0 +1,339 @@ +/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- + + Copyright (c) 2014-2015 Datalight, Inc. + All Rights Reserved Worldwide. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; use version 2 of the License. + + This program is distributed in the hope that it will be useful, + but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +/* Businesses and individuals that for commercial or other reasons cannot + comply with the terms of the GPLv2 license may obtain a commercial license + before incorporating Reliance Edge into proprietary software for + distribution in any form. Visit http://www.datalight.com/reliance-edge for + more information. +*/ +/** @file + @brief This project runs Reliance Edge on top of FreeRTOS. The example + task runs fsstress and Datalight's POSIX API test suite if + the configuration allows. + + Portions of this file are copyright (c) STMicroelectronics, to be used only + in accordance with the notice below: +*/ +/** + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2016 STMicroelectronics

+ * + * Licensed under MCD-ST Liberty SW License Agreement V2, (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.st.com/software_license_agreement_liberty_v2 + * + * 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 + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "lcd_log.h" +#include "lcd_log_conf.h" + +static bool prvSetupHardware(void); +static void SystemClock_Config(void); +static void prvRedExampleTask(void *pParam); +static void prvLcdScrollTask(void *pParam); + + +static volatile uint8_t initted = 0U; + + +int main(void) +{ + if(xTaskCreate( prvRedExampleTask, + "FILESYSTEM", + (1024U * 3U) / sizeof(StackType_t), + NULL, + tskIDLE_PRIORITY + 1U, + NULL) + != pdPASS) + { + return 1; + } + + if(xTaskCreate( prvLcdScrollTask, + "LCDSCROLL", + (1024U) / sizeof(StackType_t), + NULL, + tskIDLE_PRIORITY + 1U, + NULL) + != pdPASS) + { + return 1; + } + + /* Start the FreeRTOS task scheduler. + */ + vTaskStartScheduler(); + + /* vTaskStartScheduler() never returns unless there was not enough RAM to + start the scheduler. + */ + REDERROR(); + for( ;; ); +} + + +/** @brief Initialize hardware and drivers as needed. +*/ +static bool prvSetupHardware( void ) +{ + if(HAL_Init() != HAL_OK) + { + return false; + } + + /* System clock configuration + */ + SystemClock_Config(); + + /* LCD initialization. + */ + + BSP_LCD_Init(); + LCD_LOG_Init(); + LCD_LOG_SetHeader((uint8_t *) "Reliance Edge Example"); + + /* Joystick initialization. Datalight has observed several times where + BSP_JOY_Init() fails every time it is called until the board is + physically powered down. + */ + if(BSP_JOY_Init(JOY_MODE_GPIO) != IO_OK) + { + RedOsOutputString("Failed to init joystick control. Try disconnecting power and restarting.\n"); + return false; + } + + return true; +} + + +/** + * @brief System Clock Configuration + * The system Clock is configured as follow : + * System Clock source = PLL (HSE) + * SYSCLK(Hz) = 168000000 + * HCLK(Hz) = 168000000 + * AHB Prescaler = 1 + * APB1 Prescaler = 4 + * APB2 Prescaler = 2 + * HSE Frequency(Hz) = 25000000 + * PLL_M = 25 + * PLL_N = 336 + * PLL_P = 2 + * PLL_Q = 7 + * VDD(V) = 3.3 + * Main regulator output voltage = Scale1 mode + * Flash Latency(WS) = 5 + * @param None + * @retval None + */ +static void SystemClock_Config(void) +{ + RCC_ClkInitTypeDef RCC_ClkInitStruct; + RCC_OscInitTypeDef RCC_OscInitStruct; + + /* Enable Power Control clock + */ + __HAL_RCC_PWR_CLK_ENABLE(); + + /* The voltage scaling allows optimizing the power consumption when the device is + clocked below the maximum system frequency, to update the voltage scaling value + regarding system frequency refer to product datasheet. + */ + __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + + /* Enable HSE Oscillator and activate PLL with HSE as source + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 25; + RCC_OscInitStruct.PLL.PLLN = 336; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 7; + HAL_RCC_OscConfig(&RCC_OscInitStruct); + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 + clocks dividers + */ + RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5); + + /* STM32F405x/407x/415x/417x Revision Z devices: prefetch is supported + */ + if (HAL_GetREVID() == 0x1001) + { + /* Enable the Flash prefetch + */ + __HAL_FLASH_PREFETCH_BUFFER_ENABLE(); + } +} + + +/** @brief Reliance Edge example task. +*/ +static void prvRedExampleTask(void *pParam) +{ + /* We don't use the parameter. + */ + (void)pParam; + + if(!prvSetupHardware()) + { + REDERROR(); + while(true) + { + } + } + + initted = 1U; + + RedOsOutputString("\nReliance Edge example task started...\n"); + + #if REDCONF_API_POSIX == 1 + { + int32_t ret; + int32_t ret2; + + ret = red_init(); + if(ret == 0) + { + #if REDCONF_API_POSIX_FORMAT == 1 + ret = red_format(""); + if(ret == 0) + #endif + { + ret = red_mount(""); + if(ret == 0) + { + /* Add test code here. + */ + ;; + + ret2 = red_umount(""); + if(ret == 0) + { + ret = ret2; + } + } + } + + (void)red_uninit(); + } + } + #elif REDCONF_API_FSE == 1 + { + REDSTATUS ret; + REDSTATUS ret2; + + ret = RedFseInit(); + if(ret == 0) + { + ret = RedFseMount(0U); + if(ret == 0) + { + /* Add test code here. + */ + ;; + + ret2 = RedFseUnmount(0U); + if(ret == 0) + { + ret = ret2; + } + } + + (void)RedFseUninit(); + } + } + #endif + + RedOsOutputString("Reliance Edge example task complete.\n"); + + /* FreeRTOS tasks must never return. + */ + while(true) + { + } +} + + +/** @brief LCD scrolling task + + Enables use of the Joystick control to scroll up and down in the log + output. +*/ +static void prvLcdScrollTask(void *pParam) +{ + (void) pParam; + + while(initted == 0) + { + vTaskDelay(100); + } + + while(true) + { + JOYState_TypeDef joyState; + + joyState = BSP_JOY_GetState(); + + if(joyState == JOY_DOWN) + { + LCD_LOG_ScrollForward(); + } + else if(joyState == JOY_UP) + { + LCD_LOG_ScrollBack(); + } + + vTaskDelay(10); + } +} diff --git a/projects/freertos/st/stm324xg-eval/src/malloc.c b/projects/freertos/st/stm324xg-eval/src/malloc.c new file mode 100644 index 0000000..7922c92 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/malloc.c @@ -0,0 +1,118 @@ +/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- + + Copyright (c) 2014-2015 Datalight, Inc. + All Rights Reserved Worldwide. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; use version 2 of the License. + + This program is distributed in the hope that it will be useful, + but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +/* Businesses and individuals that for commercial or other reasons cannot + comply with the terms of the GPLv2 license may obtain a commercial license + before incorporating Reliance Edge into proprietary software for + distribution in any form. Visit http://www.datalight.com/reliance-edge for + more information. +*/ +/* @file + @brief Wrapper implementation of the C standard memory allocation functions + over FreeRTOS' pvPortMalloc and vPortFree. +*/ + +#include + +#include + +#include + +/* This is a wrapper to pvPortMalloc. It allocates the requested amount + of space plus enough to store the size of the request (to enable realloc). +*/ +void *malloc(size_t size) +{ + void *ptr; + + if(size + sizeof(size_t) < size) + { + return NULL; + } + + ptr = pvPortMalloc(size + sizeof(size_t)); + + if(ptr == NULL) + { + return NULL; + } + + *((size_t *) ptr) = size; + + return ptr + sizeof(size_t); +} + + +void free(void *ptr) +{ + if(ptr != NULL) + { + vPortFree(ptr - sizeof(size_t)); + } +} + + +void *realloc(void *ptr, size_t size) +{ + void *newptr; + size_t oldsize; + + if(ptr == NULL) + { + return malloc(size); + } + + oldsize = *((size_t *) (ptr - sizeof(size_t))); + + if(size == 0) + { + newptr = NULL; + } + else + { + newptr = malloc(size); + RedMemCpy(newptr, ptr, REDMIN(size, oldsize)); + } + + free(ptr); + + return newptr; +} + + +void *calloc(size_t size1, size_t size2) +{ + size_t totalSize = size1 * size2; + void *ptr; + + if(totalSize < size1 || totalSize < size2) + { + return NULL; + } + + ptr = malloc(totalSize); + + if(ptr == NULL) + { + return NULL; + } + + RedMemSet(ptr, 0U, totalSize); + + return ptr; +} diff --git a/projects/freertos/st/stm324xg-eval/src/osoutput.c b/projects/freertos/st/stm324xg-eval/src/osoutput.c new file mode 100644 index 0000000..c8629e0 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/osoutput.c @@ -0,0 +1,77 @@ +/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- + + Copyright (c) 2014-2015 Datalight, Inc. + All Rights Reserved Worldwide. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; use version 2 of the License. + + This program is distributed in the hope that it will be useful, + but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +/* Businesses and individuals that for commercial or other reasons cannot + comply with the terms of the GPLv2 license may obtain a commercial license + before incorporating Reliance Edge into proprietary software for + distribution in any form. Visit http://www.datalight.com/reliance-edge for + more information. +*/ +/** @file + @brief Implements outputting a character string. This implementation is + customized for the Atollic GCC compiler for STM32. +*/ +#include + +#if REDCONF_OUTPUT == 1 + +#include + + +extern int __io_putchar(int ch); + +/** @brief Write a string to a user-visible output location. + + Write a null-terminated string to the serial port, console, terminal, or + other display device, such that the text is visible to the user. + + @param pszString A null-terminated string. +*/ +void RedOsOutputString( + const char *pszString) +{ + if(pszString == NULL) + { + REDERROR(); + } + else + { + /* The arm-atollic-eabi version of putchar has been observed not to + end up calling __io_putchar() (as would have been expected), so + we call it directly instead. + */ + + uint32_t ulIdx = 0U; + + while(pszString[ulIdx] != '\0') + { + __io_putchar(pszString[ulIdx]); + + /* Serial output often requires a \r to print newlines correctly. + */ + if(pszString[ulIdx] == '\n') + { + __io_putchar('\r'); + } + + ulIdx++; + } + } +} + +#endif diff --git a/projects/freertos/st/stm324xg-eval/src/redconf.c b/projects/freertos/st/stm324xg-eval/src/redconf.c new file mode 100644 index 0000000..44f8245 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/redconf.c @@ -0,0 +1,15 @@ +/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION + UTILITY. DO NOT MODIFY. +*/ +/** @file +*/ +#include +#include +#include +#include + + +const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT] = +{ + { 512U, 1048576U, false, 1024U, 2U, "" } +}; diff --git a/projects/freertos/st/stm324xg-eval/src/redconf.h b/projects/freertos/st/stm324xg-eval/src/redconf.h new file mode 100644 index 0000000..a5b4398 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/redconf.h @@ -0,0 +1,104 @@ +/* THIS FILE WAS GENERATED BY THE DATALIGHT RELIANCE EDGE CONFIGURATION + UTILITY. DO NOT MODIFY. +*/ +/** @file +*/ +#ifndef REDCONF_H +#define REDCONF_H + + +#include + +#define REDCONF_READ_ONLY 0 + +#define REDCONF_API_POSIX 1 + +#define REDCONF_API_FSE 0 + +#define REDCONF_API_POSIX_FORMAT 1 + +#define REDCONF_API_POSIX_LINK 1 + +#define REDCONF_API_POSIX_UNLINK 1 + +#define REDCONF_API_POSIX_MKDIR 1 + +#define REDCONF_API_POSIX_RMDIR 1 + +#define REDCONF_API_POSIX_RENAME 1 + +#define REDCONF_RENAME_ATOMIC 1 + +#define REDCONF_API_POSIX_FTRUNCATE 1 + +#define REDCONF_API_POSIX_READDIR 1 + +#define REDCONF_NAME_MAX 12U + +#define REDCONF_PATH_SEPARATOR '/' + +#define REDCONF_TASK_COUNT 10U + +#define REDCONF_HANDLE_COUNT 10U + +#define REDCONF_API_FSE_FORMAT 0 + +#define REDCONF_API_FSE_TRUNCATE 0 + +#define REDCONF_API_FSE_TRANSMASKGET 0 + +#define REDCONF_API_FSE_TRANSMASKSET 0 + +#define REDCONF_OUTPUT 1 + +#define REDCONF_ASSERTS 1 + +#define REDCONF_BLOCK_SIZE 512U + +#define REDCONF_VOLUME_COUNT 1U + +#define REDCONF_ENDIAN_BIG 0 + +#define REDCONF_ALIGNMENT_SIZE 4U + +#define REDCONF_CRC_ALGORITHM CRC_SLICEBY8 + +#define REDCONF_INODE_BLOCKS 1 + +#define REDCONF_INODE_TIMESTAMPS 1 + +#define REDCONF_ATIME 0 + +#define REDCONF_DIRECT_POINTERS 4U + +#define REDCONF_INDIRECT_POINTERS 32U + +#define REDCONF_BUFFER_COUNT 12U + +#define RedMemCpyUnchecked memcpy + +#define RedMemMoveUnchecked memmove + +#define RedMemSetUnchecked memset + +#define RedMemCmpUnchecked memcmp + +#define RedStrLenUnchecked strlen + +#define RedStrCmpUnchecked strcmp + +#define RedStrNCmpUnchecked strncmp + +#define RedStrNCpyUnchecked strncpy + +#define REDCONF_TRANSACT_DEFAULT (( RED_TRANSACT_CREAT | RED_TRANSACT_MKDIR | RED_TRANSACT_RENAME | RED_TRANSACT_LINK | RED_TRANSACT_UNLINK | RED_TRANSACT_FSYNC | RED_TRANSACT_CLOSE | RED_TRANSACT_VOLFULL | RED_TRANSACT_UMOUNT ) & RED_TRANSACT_MASK) + +#define REDCONF_IMAP_INLINE 0 + +#define REDCONF_IMAP_EXTERNAL 1 + +#define REDCONF_IMAGE_BUILDER 0 + +#define REDCONF_CHECKER 0 + +#endif diff --git a/projects/freertos/st/stm324xg-eval/src/redtypes.h b/projects/freertos/st/stm324xg-eval/src/redtypes.h new file mode 100644 index 0000000..3192e38 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/redtypes.h @@ -0,0 +1,97 @@ +/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- + + Copyright (c) 2014-2015 Datalight, Inc. + All Rights Reserved Worldwide. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; use version 2 of the License. + + This program is distributed in the hope that it will be useful, + but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +/* Businesses and individuals that for commercial or other reasons cannot + comply with the terms of the GPLv2 license may obtain a commercial license + before incorporating Reliance Edge into proprietary software for + distribution in any form. Visit http://www.datalight.com/reliance-edge for + more information. +*/ +/** @file + @brief Defines basic types used by Reliance Edge. + + The following types *must* be defined by this header, either directly (using + typedef) or indirectly (by including other headers, such as the C99 headers + stdint.h and stdbool.h): + + - bool: Boolean type, capable of storing true (1) or false (0) + - uint8_t: Unsigned 8-bit integer + - int8_t: Signed 8-bit integer + - uint16_t: Unsigned 16-bit integer + - int16_t: Signed 16-bit integer + - uint32_t: Unsigned 32-bit integer + - int32_t: Signed 32-bit integer + - uint64_t: Unsigned 64-bit integer + - int64_t: Signed 64-bit integer + - uintptr_t: Unsigned integer capable of storing a pointer, preferably the + same size as pointers themselves. + + These types deliberately use the same names as the standard C99 types, so + that if the C99 headers stdint.h and stdbool.h are available, they may be + included here. + + If the user application defines similar types, those may be reused. For + example, suppose there is an application header apptypes.h which defines + types with a similar purpose but different names. That header could be + reused to define the types Reliance Edge needs: + + ~~~{.c} + #include + + typedef BOOL bool; + typedef BYTE uint8_t; + typedef INT8 int8_t; + // And so on... + ~~~ + + If there are neither C99 headers nor suitable types in application headers, + this header should be populated with typedefs that define the required types + in terms of the standard C types. This requires knowledge of the size of + the C types on the target hardware (e.g., how big is an "int" or a pointer). + Below is an example which assumes the target has 8-bit chars, 16-bit shorts, + 32-bit ints, 32-bit pointers, and 64-bit long longs: + + ~~~{.c} + typedef int bool; + typedef unsigned char uint8_t; + typedef signed char int8_t; + typedef unsigned short uint16_t; + typedef short int16_t; + typedef unsigned int uint32_t; + typedef int int32_t; + typedef unsigned long long uint64_t; + typedef long long int64_t; + typedef uint32_t uintptr_t; + ~~~ +*/ +#ifndef REDTYPES_H +#define REDTYPES_H + + +/* Defines bool. +*/ +#include + +/* Defines uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, + int64_t, and uintptr_t. +*/ +#include + + +#endif + diff --git a/projects/freertos/st/stm324xg-eval/src/stm32f4xx_hal_conf.h b/projects/freertos/st/stm324xg-eval/src/stm32f4xx_hal_conf.h new file mode 100644 index 0000000..37c2651 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/stm32f4xx_hal_conf.h @@ -0,0 +1,426 @@ +/** + ****************************************************************************** + * @file stm32f4xx_hal_conf.h + * @author MCD Application Team + * @version V1.4.4 + * @date 22-January-2016 + * @brief HAL configuration template file. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2016 STMicroelectronics

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32F4xx_HAL_CONF_H +#define __STM32F4xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED +/* #define HAL_ADC_MODULE_ENABLED */ +/* #define HAL_CAN_MODULE_ENABLED */ +#define HAL_CRC_MODULE_ENABLED +/* #define HAL_CRYP_MODULE_ENABLED */ +/* #define HAL_DAC_MODULE_ENABLED */ +/* #define HAL_DCMI_MODULE_ENABLED */ +#define HAL_DMA_MODULE_ENABLED +/* #define HAL_DMA2D_MODULE_ENABLED */ +/* #define HAL_ETH_MODULE_ENABLED */ +#define HAL_FLASH_MODULE_ENABLED +/* #define HAL_NAND_MODULE_ENABLED */ +/* #define HAL_NOR_MODULE_ENABLED */ +/* #define HAL_PCCARD_MODULE_ENABLED */ +#define HAL_SRAM_MODULE_ENABLED +#define HAL_SDRAM_MODULE_ENABLED +/* #define HAL_HASH_MODULE_ENABLED */ +#define HAL_GPIO_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +/* #define HAL_I2S_MODULE_ENABLED */ +/* #define HAL_IWDG_MODULE_ENABLED */ +/* #define HAL_LTDC_MODULE_ENABLED */ +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +/* #define HAL_RNG_MODULE_ENABLED */ +#define HAL_RTC_MODULE_ENABLED +/* #define HAL_SAI_MODULE_ENABLED */ +#define HAL_SD_MODULE_ENABLED +/* #define HAL_SPI_MODULE_ENABLED */ +/* #define HAL_TIM_MODULE_ENABLED */ +#define HAL_UART_MODULE_ENABLED +/* #define HAL_USART_MODULE_ENABLED */ +/* #define HAL_IRDA_MODULE_ENABLED */ +/* #define HAL_SMARTCARD_MODULE_ENABLED */ +/* #define HAL_WWDG_MODULE_ENABLED */ +#define HAL_CORTEX_MODULE_ENABLED +/* #define HAL_PCD_MODULE_ENABLED */ +#define HAL_HCD_MODULE_ENABLED + + +/* ########################## HSE/HSI Values adaptation ##################### */ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#if !defined (HSE_VALUE) + #define HSE_VALUE ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT ((uint32_t)5000) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#if !defined (HSI_VALUE) + #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE ((uint32_t)32000) +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz + The real value may vary depending on the variations + in voltage and temperature. */ +/** + * @brief External Low Speed oscillator (LSE) value. + */ +#if !defined (LSE_VALUE) + #define LSE_VALUE ((uint32_t)32768) /*!< Value of the External Low Speed oscillator in Hz */ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/** + * @brief External clock source for I2S peripheral + * This value is used by the I2S HAL module to compute the I2S clock source + * frequency, this source is inserted directly through I2S_CKIN pad. + */ +#if !defined (EXTERNAL_CLOCK_VALUE) + #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000) /*!< Value of the Internal oscillator in Hz*/ +#endif /* EXTERNAL_CLOCK_VALUE */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY ((uint32_t)0x0F) /*!< tick interrupt priority */ +#define USE_RTOS 0 +#define PREFETCH_ENABLE 0 /* The prefetch will be enabled in SystemClock_Config(), depending on the used + STM32F405/415/07/417 device: RevA (prefetch must be off) or RevZ (prefetch can be on/off) */ +#define INSTRUCTION_CACHE_ENABLE 1 +#define DATA_CACHE_ENABLE 1 + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1 */ + +/* ################## Ethernet peripheral configuration ##################### */ + +/* Section 1 : Ethernet peripheral configuration */ + +/* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ +#define MAC_ADDR0 2 +#define MAC_ADDR1 0 +#define MAC_ADDR2 0 +#define MAC_ADDR3 0 +#define MAC_ADDR4 0 +#define MAC_ADDR5 0 + +/* Definition of the Ethernet driver buffers size and count */ +#define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ +#define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ +#define ETH_RXBUFNB ((uint32_t)4) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ +#define ETH_TXBUFNB ((uint32_t)4) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ + +/* Section 2: PHY configuration section */ + +/* DP83848 PHY Address*/ +#define DP83848_PHY_ADDRESS 0x01 +/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ +#define PHY_RESET_DELAY ((uint32_t)0x000000FF) +/* PHY Configuration delay */ +#define PHY_CONFIG_DELAY ((uint32_t)0x00000FFF) + +#define PHY_READ_TO ((uint32_t)0x0000FFFF) +#define PHY_WRITE_TO ((uint32_t)0x0000FFFF) + +/* Section 3: Common PHY Registers */ + +#define PHY_BCR ((uint16_t)0x00) /*!< Transceiver Basic Control Register */ +#define PHY_BSR ((uint16_t)0x01) /*!< Transceiver Basic Status Register */ + +#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */ +#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */ +#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */ +#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */ +#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */ +#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */ +#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */ +#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */ +#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */ +#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */ + +#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */ +#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */ +#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */ + +/* Section 4: Extended PHY Registers */ + +#define PHY_SR ((uint16_t)0x10) /*!< PHY status register Offset */ +#define PHY_MICR ((uint16_t)0x11) /*!< MII Interrupt Control Register */ +#define PHY_MISR ((uint16_t)0x12) /*!< MII Interrupt Status and Misc. Control Register */ + +#define PHY_LINK_STATUS ((uint16_t)0x0001) /*!< PHY Link mask */ +#define PHY_SPEED_STATUS ((uint16_t)0x0002) /*!< PHY Speed mask */ +#define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /*!< PHY Duplex mask */ + +#define PHY_MICR_INT_EN ((uint16_t)0x0002) /*!< PHY Enable interrupts */ +#define PHY_MICR_INT_OE ((uint16_t)0x0001) /*!< PHY Enable output interrupt events */ + +#define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /*!< Enable Interrupt on change of link status */ +#define PHY_LINK_INTERRUPT ((uint16_t)0x2000) /*!< PHY link status interrupt mask */ + + /* ################## SPI peripheral configuration ########################## */ + +/* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver +* Activated: CRC code is present inside driver +* Deactivated: CRC code cleaned from driver +*/ + +#define USE_SPI_CRC 1U + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32f4xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32f4xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32f4xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32f4xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32f4xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_CAN_MODULE_ENABLED + #include "stm32f4xx_hal_can.h" +#endif /* HAL_CAN_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32f4xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED + #include "stm32f4xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DMA2D_MODULE_ENABLED + #include "stm32f4xx_hal_dma2d.h" +#endif /* HAL_DMA2D_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED + #include "stm32f4xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_DCMI_MODULE_ENABLED + #include "stm32f4xx_hal_dcmi.h" +#endif /* HAL_DCMI_MODULE_ENABLED */ + +#ifdef HAL_ETH_MODULE_ENABLED + #include "stm32f4xx_hal_eth.h" +#endif /* HAL_ETH_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED + #include "stm32f4xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_SRAM_MODULE_ENABLED + #include "stm32f4xx_hal_sram.h" +#endif /* HAL_SRAM_MODULE_ENABLED */ + +#ifdef HAL_NOR_MODULE_ENABLED + #include "stm32f4xx_hal_nor.h" +#endif /* HAL_NOR_MODULE_ENABLED */ + +#ifdef HAL_NAND_MODULE_ENABLED + #include "stm32f4xx_hal_nand.h" +#endif /* HAL_NAND_MODULE_ENABLED */ + +#ifdef HAL_PCCARD_MODULE_ENABLED + #include "stm32f4xx_hal_pccard.h" +#endif /* HAL_PCCARD_MODULE_ENABLED */ + +#ifdef HAL_SDRAM_MODULE_ENABLED + #include "stm32f4xx_hal_sdram.h" +#endif /* HAL_SDRAM_MODULE_ENABLED */ + +#ifdef HAL_HASH_MODULE_ENABLED + #include "stm32f4xx_hal_hash.h" +#endif /* HAL_HASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32f4xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED + #include "stm32f4xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED + #include "stm32f4xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LTDC_MODULE_ENABLED + #include "stm32f4xx_hal_ltdc.h" +#endif /* HAL_LTDC_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32f4xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED + #include "stm32f4xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32f4xx_hal_rtc.h" +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SAI_MODULE_ENABLED + #include "stm32f4xx_hal_sai.h" +#endif /* HAL_SAI_MODULE_ENABLED */ + +#ifdef HAL_SD_MODULE_ENABLED + #include "stm32f4xx_hal_sd.h" +#endif /* HAL_SD_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32f4xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32f4xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32f4xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32f4xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED + #include "stm32f4xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32f4xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32f4xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED + #include "stm32f4xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +#ifdef HAL_HCD_MODULE_ENABLED + #include "stm32f4xx_hal_hcd.h" +#endif /* HAL_HCD_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr: If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ + #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(uint8_t* file, uint32_t line); +#else + #define assert_param(expr) ((void)0) +#endif /* USE_FULL_ASSERT */ + +/** + * @} + */ + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_HAL_CONF_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/projects/freertos/st/stm324xg-eval/src/stm32f4xx_it.c b/projects/freertos/st/stm324xg-eval/src/stm32f4xx_it.c new file mode 100644 index 0000000..27d23ce --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/stm32f4xx_it.c @@ -0,0 +1,115 @@ +/** + ****************************************************************************** + * @file stm32f4xx_it.c + * @brief Interrupt Service Routines. + ****************************************************************************** + * + * COPYRIGHT(c) 2016 STMicroelectronics + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ +#include +#include +#include + +#include + +#include "stm32f4xx_it.h" + + +/******************************************************************************/ +/* Cortex-M4 Processor Interruption and Exception Handlers */ +/******************************************************************************/ + +void NMI_Handler(void) +{ +} + + +void HardFault_Handler(void) +{ + REDERROR(); + while(true) {} +} + + +void BusFault_Handler(void) +{ + REDERROR(); + while(true) {} +} + + +void MemManage_Handler(void) +{ + REDERROR(); + while(true) {} +} + + +void UsageFault_Handler(void) +{ + REDERROR(); + while(true) {} +} + + +void DebugMon_Handler(void) +{ +} + + +void SysTick_Handler(void) +{ + HAL_IncTick(); + osSystickHandler(); +} + + +/******************************************************************************/ +/* STM32F4xx Peripheral Interrupt Handlers */ +/* Add here the Interrupt Handlers for the used peripherals. */ +/* For the available peripheral interrupt handler names, */ +/* please refer to the startup file (startup_stm32f4xx.s). */ +/******************************************************************************/ + +void DMA2_Stream3_IRQHandler(void) +{ + BSP_SD_DMA_Rx_IRQHandler(); +} + + +void DMA2_Stream6_IRQHandler(void) +{ + BSP_SD_DMA_Tx_IRQHandler(); +} + + +void SDIO_IRQHandler(void) +{ + BSP_SD_IRQHandler(); +} + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/projects/freertos/st/stm324xg-eval/src/stm32f4xx_it.h b/projects/freertos/st/stm324xg-eval/src/stm32f4xx_it.h new file mode 100644 index 0000000..1dc5330 --- /dev/null +++ b/projects/freertos/st/stm324xg-eval/src/stm32f4xx_it.h @@ -0,0 +1,58 @@ +/** + ****************************************************************************** + * @file stm32f4xx_it.h + * @brief This file contains the headers of the interrupt handlers. + ****************************************************************************** + * + * COPYRIGHT(c) 2016 STMicroelectronics + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ +#ifndef __STM32F4xx_IT_H +#define __STM32F4xx_IT_H + +#ifdef __cplusplus + extern "C" { +#endif + +void NMI_Handler(void); +void HardFault_Handler(void); +void BusFault_Handler(void); +void MemManage_Handler(void); +void UsageFault_Handler(void); +void DebugMon_Handler(void); +void SysTick_Handler(void); +void DMA2_Stream3_IRQHandler(void); +void DMA2_Stream6_IRQHandler(void); +void SDIO_IRQHandler(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32F4xx_IT_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/projects/win32/redconf.c b/projects/win32/redconf.c index 6cdf7f0..2d8d892 100644 --- a/projects/win32/redconf.c +++ b/projects/win32/redconf.c @@ -11,6 +11,5 @@ const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT] = { - { 512U, 65536U, false, 1024U, "VOL0:"} + { 512U, 65536U, false, 1024U, 0U, "VOL0:" } }; - diff --git a/projects/win32/redconf.h b/projects/win32/redconf.h index 27b44af..f00cad6 100644 --- a/projects/win32/redconf.h +++ b/projects/win32/redconf.h @@ -102,4 +102,3 @@ #define REDCONF_CHECKER 0 #endif -