summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRyan Harkin <ryan.harkin@linaro.org>2014-02-10 17:17:04 +0000
committerDan Handley <dan.handley@arm.com>2014-02-20 19:06:34 +0000
commitcd529320988a559c3408292f09e443233d2157c3 (patch)
tree269f79bb314e15220227cda09ca8f56d7cae7ca3 /drivers
parent2f2cef46573cc55204e7873795b2c31fcc9f6216 (diff)
Fix semihosting with latest toolchain
Fixes issues #10: https://github.com/ARM-software/tf-issues/issues/10 This patch changes all/most variables of type int to be size_t or long to fix the sizing and alignment problems found when building with the newer toolchains such as Linaro GCC 13.12 or later. Change-Id: Idc9d48eb2ff9b8c5bbd5b227e6907263d1ea188b Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/io/io_semihosting.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/io/io_semihosting.c b/drivers/io/io_semihosting.c
index 12d8315..14ec687 100644
--- a/drivers/io/io_semihosting.c
+++ b/drivers/io/io_semihosting.c
@@ -94,7 +94,7 @@ static int sh_file_open(struct io_dev_info *dev_info __attribute__((unused)),
const void *spec, struct io_entity *entity)
{
int result = IO_FAIL;
- int sh_result = -1;
+ long sh_result = -1;
const io_file_spec *file_spec = (io_file_spec *)spec;
assert(file_spec != NULL);
@@ -103,7 +103,7 @@ static int sh_file_open(struct io_dev_info *dev_info __attribute__((unused)),
sh_result = semihosting_file_open(file_spec->path, file_spec->mode);
if (sh_result > 0) {
- entity->info = sh_result;
+ entity->info = (uintptr_t)sh_result;
result = IO_SUCCESS;
} else {
result = IO_FAIL;
@@ -116,11 +116,11 @@ static int sh_file_open(struct io_dev_info *dev_info __attribute__((unused)),
static int sh_file_seek(struct io_entity *entity, int mode, ssize_t offset)
{
int result = IO_FAIL;
- int file_handle, sh_result;
+ long file_handle, sh_result;
assert(entity != NULL);
- file_handle = (int)entity->info;
+ file_handle = (long)entity->info;
sh_result = semihosting_file_seek(file_handle, offset);
@@ -138,8 +138,8 @@ static int sh_file_len(struct io_entity *entity, size_t *length)
assert(entity != NULL);
assert(length != NULL);
- int sh_handle = entity->info;
- int sh_result = semihosting_file_length(sh_handle);
+ long sh_handle = (long)entity->info;
+ long sh_result = semihosting_file_length(sh_handle);
if (sh_result >= 0) {
result = IO_SUCCESS;
@@ -155,15 +155,15 @@ static int sh_file_read(struct io_entity *entity, void *buffer, size_t length,
size_t *length_read)
{
int result = IO_FAIL;
- int sh_result = -1;
- int bytes = length;
- int file_handle;
+ long sh_result = -1;
+ size_t bytes = length;
+ long file_handle;
assert(entity != NULL);
assert(buffer != NULL);
assert(length_read != NULL);
- file_handle = (int)entity->info;
+ file_handle = (long)entity->info;
sh_result = semihosting_file_read(file_handle, &bytes, buffer);
@@ -182,15 +182,15 @@ static int sh_file_write(struct io_entity *entity, const void *buffer,
size_t length, size_t *length_written)
{
int result = IO_FAIL;
- int sh_result = -1;
- int file_handle;
- int bytes = length;
+ long sh_result = -1;
+ long file_handle;
+ size_t bytes = length;
assert(entity != NULL);
assert(buffer != NULL);
assert(length_written != NULL);
- file_handle = (int)entity->info;
+ file_handle = (long)entity->info;
sh_result = semihosting_file_write(file_handle, &bytes, buffer);
@@ -208,12 +208,12 @@ static int sh_file_write(struct io_entity *entity, const void *buffer,
static int sh_file_close(struct io_entity *entity)
{
int result = IO_FAIL;
- int sh_result = -1;
- int file_handle;
+ long sh_result = -1;
+ long file_handle;
assert(entity != NULL);
- file_handle = (int)entity->info;
+ file_handle = (long)entity->info;
sh_result = semihosting_file_close(file_handle);